Problem Description

There are N rooms in the palace of “Hou”. (Obviously Roba is the master!) There are Ai girls in the i-th room and their value of charm is 1, 2... Ai, respectively.
Roba will pick out one girl in one room (randomly). Obviously, only N girl could meet Roba in a single day! Every girl has her value of charm. Now Roba wants to know the number of grils whose value of charm is exactly x! So F(Girl_Selected, x) is defined as the number of grils whose value of charm is exactly x in Girl_Selected.
For example, when N = 3, and Roba pick out three grils whose value of charm is 2, 3, 2 respectively, that is to say, Girl_Selected = {2,3,2}, so F({2,3,2}, 2) = 2, F({2,3,2},3) = 1, F({2,3,2},1) = 0.
Now Roba has Q queries. Each query will be one of the following operations:
1 val : Output the sum of F(Girl_Selected _possible_way, val) for all possible combination. As we know, there must be

different ways for Roba to pick out the N grils in a single day! Since the answer may be huge, you should output the answer mod P.
2 pos val : rearrange room pos from ( Apos ) to val, which means Roba maybe sometimes Friends Old and New! After arrangement, val grils in room pos and their value of charm is 1,2,… val respectively ! Note that 1<=val<=109 and 0<=pos<N.

Input
The first line is an integer T indicates the number of the test cases. (T <= 40)
Each case begins with one line containing three integers N (1<=N<=105), P (2 <= P <= 109, P is a prime) and Q(1<= Q <= 105), representing the number of rooms of palace of “Hou”, the mod number and the number of queries respectively. Then one line contains N numbers, the i-th number indicating the initial Ai. In the next Q line, each line contains one operation fits the description. (1 <= Ai <= 109)

Output
Output one line for each type-1 query.

Sample Input
1
4 7 5
1 2 3 4
1 2
2 0 7
1 4
2 0 5
1 3

Sample Output
5
3
3

Problem Description As we all know, after a series of international contests, the leaders are wild about ranking the schools to appraise the development of the ACM of our country. There are a lot of schools attend the contests, and each school has some teams or none, and each team may get some prizes of not. There are three kinds of prizes of the contests: gold, silver and copper, and gold is the best one and silver is better than copper. Now we get the result of all the schools, you should rank them, and print them according to the below rules: 1) We define the ranks between any two schools (or two teams) as the follow rules: firstly we compare the number of gold prizes, and the school is better whose number of gold prizes is larger, and if the numbers of gold prize are the same then compare the silver prizes and then copper prizes. If all the numbers of gold prizes and silver prizes and copper prizes are the same, then we just say the two school (or two teams) are the same good, and their ranks are the same, you have to obey the lexicographic orders when you print them, though. 2) We define the rank number as the following rule: if there are three schools (or three teams), A is as good as B, but better than C. So the rank number of A and B is 1 (the rank number starts from 1), and C is 3, we omit the rank number 2. If more, the rule goes on. Input There are T cases come, and the first line contains just one integer T. In each case of following T ones, there is an integer N indicates that there are N following lines describe the information of the encouragement. Each line contains fours strings: the name of the school, the name of the team, the kind of the prize ("none" means the team gets no prize), and the contest hosting place. Any string is no longer than fifty characters. T<=10, N <=200, and the school number will not be beyond N, and the team number of each school will not exceed 100. Output For each case, firstly you show the number of school, and then show the rank list as the format: the school name, the rank number, and the numbers of gold prize and silver prize and copper prize. Then you print the teams' information: the team name, the rank number, the numbers of gold prize and silver prize and copper prize. After printing the rank list, firstly you print the number of the contests, and then you have to print the contest information: the name of hosting place (shown lexicographically), the number of gold prize, and the number of silver prize and copper. You can assume all the data is correct. Sample Input 1 4 aaa mayday gold nanjing bbb let's_go silver beijing ccc how_do_you_do??? none xihua aaa acm.hdu.edu.cn copper xihua Sample Output Case 1: **************** school number: 3 aaa 1 1 0 1 team number: 2 mayday 1 1 0 0 acm.hdu.edu.cn 2 0 0 1 bbb 2 0 1 0 team number: 1 let's_go 1 0 1 0 ccc 3 0 0 0 team number: 1 how_do_you_do??? 1 0 0 0 **************** contest number: 3 beijing 0 1 0 nanjing 1 0 0 xihua 0 0 1 ****************

1：以01stream.txt文件,好像不能上传附件，文件内容为01所组成的数据流，为自己所写程序的输入，读取中文件中的01数据流； 2：设定窗口大小1000，以不超过50%的相对误差回答任意时刻，当前窗口中有多少个1-bit； 3：设定窗口大小2000，以不超过10%的相对误差回答任意时刻，当前窗口中有多少个1-bit； 4：编写一个精确计算当前窗口中1-bit个数的精确程序，比较精确程序在运行时间和空间和DGIM算法的差异。 没有头绪，有熟悉这种算法的大神么，谢谢了。 大数据相关的
Java语言如何实现一个算法
Java语言如何实现一个算法，我要计算1 2 3 4 4个数字，每3个数字相加乘以另一个数字的倒数，最小的那个

Problem Description 在地球上的一个鲜为人知的角落,住着这样一群人.他们整日与算法为伴,以研究出高效的算法为荣.就连竞选村长都是以Word Final的标准进行的.这里的算法风气之浓厚,就连当地的动物们都受到了极大的影响.旺财是村长--TCL(相当于世界冠军的水平)的爱犬,从小就受到村长一家的熏陶,当别的小动物都还在算A+B的的时候,旺财已经学会"迪杰斯特拉"和"贝尔曼-佛德"了,因此他一直是当地的小动物们崇拜的对象,它们眼中的最有希望进Animal Kingdom World Final的明日之星,就连村里面耕地的老牛们见了他都要叫声"大牛好~". 可是,旺财也有他的苦衷.TCL对待他实在是太好了,每天都请医疗专家周海角为旺财开出许多的保健药品(据说TCL那么牛就是因为从小吃周海角开的药).周海角作为一名医疗专家,有着数十年的江湖行医经验,他的药方不是一般人能开得出来的.他每次都会开出两张药方,第一张药方上写有N1种药品(每种药的编号分别为1,2,3……,N1),第二张药方上写有N2种药品(编号分别为N1+1,N1+2,N1+3……,N1+N2),之所以要这样,是因为第一张药方上的药只有村北的药店里才有,而第二张药方上的药只有村南的药店里才有,并且,药方上还明确指出哪些药必须在哪些药服用之后才能服用,否则会有脑残的危险!还需要一提的药是不能打包带回去,只能在相应的药店里在专家指导下当场服用,安全第一嘛。旺财还面临的一个问题是:村北和村南的药店相隔甚远,而且两地之间还有一个规定凡是4条腿或4个轮子的东西经过都要交钱的收费站,作为一条精通算法的小狗,旺财始终把"提高效率减小耗费"作为自己的座右铭.他在想要怎样吃药才能使跑远路的次数最少,这样过路费也会最小.从村南到村北或从村北到村南算一次跑远路,到最后吃完药跑回家,也算一次哦. Input 有多组输入数据.每组数组的第一行有三个整数N1, N2, M. 接下来有M行数组,每行有两个整数 a, b, 分别表示在吃第a种药之前,需要先吃第b种药. 最后一组数据后,会有三个0表示输入结束。所有的数据中, 1<=N1,N2<=60000, 0<=M<=120000, 1<=a,b<=N1+N2. Output 每组数据输出一个整数,表示旺财把药房上的药吃完所需的跑远路的次数. Sample Input 5 3 3 1 2 5 1 3 2 0 0 0 Sample Output 3

Problem Description Today is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ? Input There are multiply cases. One line is one case. There are three integers, year(0<year<10000), month(0<=month<13), day(0<=day<32). Output Output one line. if the date is illegal, you should output "illegal". Or, you should output what day it is. Sample Input 2007 11 17 Sample Output Saturday

Problem Description Ola Clason’s Hardware store is an old company where most work is done “the old way”. Among other things, the company is the one and only provider of marble house numbers. These house numbers have become extremely popular among construction companies, especially the ones building luxury estates. This is of course great for Ola Clason, but also a small problem. Nisse, who has been managing the incoming orders has turned out to be a bottleneck in Ola’s business. Most orders are on the form “Coconut Drive 200, 202, 204, ..., 220”. This means every even number between 200 and 220. Nisse’s work is to transfer an order to a list of necessary digits and other symbols. Your assignment is to write a program that automates Nisse’s work with orders containing only positive integer house numbers. Nisse will still in the future process all special orders (those including non digit symbols) by hand. Input On the first line of input is a single positive integer n, specifying the number of orders that follow. The first line of each order contains the road name for that order. No road name is longer than 50 characters. The second line states the total number of buildings needing new marble numbers on that order. Then follows the different house number specifications on several lines. These lines are of two kinds: single number lines and multiple number lines. A single number line simply consists of the house number by itself, while a multiple number line starts with a “+”-sign, followed by three positive integer numbers: first number, last number and the interval between the house numbers. The distance between the first and last house number will always be a multiple of the house number interval. A house number will never have more than five digits. After the last house number specification line, the next order follows, if there is any. Output For each order, the output consists of 13 lines. The first and second lines should be identical with the first two input lines. Then, there follows 10 lines with information on how many marble digits of each kind the order consists of. These rows are on the format “Make X digit Y” where X is how many copies of digit Y they need to make. The last row states the total number Z of digits needed, on the format “In total Z digits”. If there is only one digit to produce, it should say “In total 1 digit”, in order to be grammatically correct. Sample Input 1 Short Street 23 addresses + 101 125 2 275 + 100 900 100 Sample Output Short Street 23 addresses Make 23 digit 0 Make 22 digit 1 Make 5 digit 2 Make 4 digit 3 Make 1 digit 4 Make 5 digit 5 Make 1 digit 6 Make 4 digit 7 Make 1 digit 8 Make 3 digit 9 In total 69 digits
Cycling的计算的一个算法，用的C程序语言
Problem Description You want to cycle to a programming contest. The shortest route to the contest might be over the tops of some mountains and through some valleys. From past experience you know that you perform badly in programming contests after experiencing large differences in altitude. Therefore you decide to take the route that minimizes the altitude difference, where the altitude difference of a route is the difference between the maximum and the minimum height on the route. Your job is to write a program that finds this route. You are given: the number of crossings and their altitudes, and the roads by which these crossings are connected. Your program must find the route that minimizes the altitude difference between the highest and the lowest point on the route. If there are multiple possibilities, choose the shortest one. For example: In this case the shortest path from 1 to 7 would be through 2, 3 and 4, but the altitude difference of that path is 8. So, you prefer to go through 5, 6 and 4 for an altitude difference of 2. (Note that going from 6 directly to 7 directly would have the same difference in altitude, but the path would be longer!) Input On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case: One line with two integers n (1 <= n <= 100) and m (0 <= m <= 5000): the number of crossings and the number of roads. The crossings are numbered 1..n. n lines with one integer hi (0 <= hi <= 1 000 000 000): the altitude of the i-th crossing. m lines with three integers aj , bj (1 <= aj , bj <= n) and cj (1 <= cj <= 1 000 000): this indicates that there is a two-way road between crossings aj and bj of length cj . You may assume that the altitude on a road between two crossings changes linearly. You start at crossing 1 and the contest is at crossing n. It is guaranteed that it is possible to reach the programming contest from your home. Output For each testcase, output one line with two integers separated by a single space: the minimum altitude difference, and the length of shortest path with this altitude difference. Sample Input 1 7 9 4 9 1 3 3 5 4 1 2 1 2 3 1 3 4 1 4 7 1 1 5 4 5 6 4 6 7 4 5 3 2 6 4 2 Sample Output 2 11

Problem Description As a ninja, Saito Hajime has to fight many opponents who are foolish enough to challenge his might. Most of these opponents fall easily to Saito's great martial arts techniques and ninjitsus(A ninjitsu is a technique that comes from the ninjas inner power called Qi.). From time to time however, the great Saito Hajime has to take care of a particularly powerful and skilled foe(In the age of ninjas, such a foe was commonly referred to as Boss.). This foe usually enters the combat after several dozens of his/her minions have been defeated by Saito. Saito always encounters such foes in empty rectangular rooms. In order to defeat such a powerful foe, Saito has to perform a special ninjitsu known as Saito Hajime's Zero Stance Ultimate Finishing Strike. This strike involves hitting his foe by performing a flying kick that starts at Saito's current position. Of course, a simple flying kick will not be enough to defeat a powerful foe, but Saito can improve the power of his strike by bouncing off several walls before hitting his foe. Every bounce gives his attack more power, so that with enough bounces any foe can be defeated. Note that Saito always bounces off a wall according to the rule \angle of incidence is equal to the angle of reflection". Saito knows how often he has to bounce off a wall to defeat a particular foe. He must be careful though,if his attack takes too long, his foe might be able to dodge his attack. Therefore, the distance traveled by Saito while performing his strike must be as short as possible. Can you figure out how often Saito will hit each of the four walls while performing his strike? Input The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format: 1.A line with three positive integer numbers L,W (3 <= L;W <= 100), and B (0 <= B <= 10^5): the length and width of the room, and the number of bounces necessary to defeat his foe. 2.A line with two positive integer numbers xf (0 < xf < L) and yf (0 < yf < W): the starting coordinates of Saito. 3.A line with two positive integer numbers xf (0 < xf < L) and yf (0 < yf < W): the coordinates of the foe. The bottom left corner of the room is at (0, 0). You can assume that Saito and his foe do not start at the same position. If Saito hits a corner of the room, this counts as two bounces, one for each wall. Also, Saito is able to fly over his foe while performing his strike. Output For every test case in the input, the output should contain: 1.One line with four integers: the number of times Saito has hit the north, east, south, and west wall, respectively. The north wall is in the positive y-direction and the east wall is in the positive x-direction. In case there are multiple possibilities, you must output all of them ordered lexicographically, each on a separate line. 2.One line containing the number 0. Sample Input 2 3 3 1 1 1 2 2 6 6 3 3 1 2 4 Sample Output 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0

# c语言实现 输入若干个正整数， 从输入的若干个数字中选择一部分数字出来(可以全部选择)， 将选择的数字分成n组，每组数字的个数可以不一样， 但要求每组数字的和相等并且尽可能最大！ 如果可以实现则输出最大和，如果无法完成则输出0

Problem Description “JezzBall is a computer game in which red-and-white ‘atoms’ bounce about a rectangular field of play. The player advances to later levels (with correspondingly higher numbers of atoms and lives) by containing the atoms in progressively smaller spaces, until at least 75% of the area is blocked off.” (wikipedia.org) The picture to the right is a screenshot from the original game, where the player has already covered some space (the black part). In this problem we will consider a slightly different, non-discrete, version of the game. That is, while the length unit is still pixels, you should treat them as non-discrete in the sense that all objects can be at non-integer coordinates and all movements are continuous. The size of the playing field will be 1024 × 768 pixels. The atoms that bounce around will be infinitely thin (and not round balls like in the screenshot). The atoms will move at a constant speed and only change direction when hitting the edge of the playing field (x-coordinate 0 and 1024 or y-coordinate 0 and 768), where they bounce without loss of energy. The atoms do not hit each other. The player can divide the playing field in two by shooting a horizontal or vertical ray from (in this problem) a fixed point on the playing field. The ray will then extend in both directions simultaneously (up and down for vertical rays, or left and right for horizontal rays) at a uniform speed (in this problem always 200 pixels per second). The rays will also be infinitely thin. If no atom touches any part of the ray while it’s still being extended, the field has successfully been divided. Otherwise the player loses a life. If an atom touches the endpoint of an extending edge, this will not be counted as a hit. Also, if an atom hits the ray at the same instant it has finished extending, this will also not count as a hit. Write a program that determines the minimum time the player must wait before he can start extending a ray so that an atom will not hit it before the ray has been completed. Input Each test case starts with a line containing a single integer n, the number of atoms (1 ≤ n ≤ 10). Then follows a line containing two integers, x and y, the position where the two ray ends will start extending from (0 < x < 1024, 0 < y < 768). Then n lines follow, each containing four integers, x, y, vx and vy describing the initial position and speed of an atom (0 < x < 1024, 0 < y < 768, 1 ≤ |vx| ≤ 200, 1 ≤ |vy| ≤ 200). The speed of the atom in the x direction is given by vx, and the speed in the y direction is given by vy. All positions in each input will be distinct. The input is terminated by a case where n = 0, which should not be processed. There will be at most 25 test cases. Output For each test case, output the minimum time (with exactly 5 decimal digits) until the player can extend either a horizontal or vertical ray without an atom colliding with it while it is being drawn. The input will be constructed so that the first time this occurs will be during an open interval at least 10-5 seconds long. If no such interval is found during the first 10000 seconds, output “Never” (without quotes). Sample Input 3 700 420 360 290 170 44 900 150 -53 20 890 100 130 -100 4 10 10 1 1 192 144 513 385 192 144 1023 767 -192 -144 511 383 -192 -144 0 Sample Output 2.80094 Never

Problem Description After the 32nd ACM/ICPC regional contest, Wiskey is beginning to prepare for CET-6. He has an English words table and read it every morning. One day, Wiskey's chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time. The table has n*n grids. Your task is tell Wiskey the final status of the table. Input Each line will contain two number. The first is postive integer n (0 < n <= 10). The seconed is signed 32-bit integer m. if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times. Following n lines. Every line contain n characters. Output Output the n*n grids of the final status. Sample Input 3 2 123 456 789 3 -1 123 456 789 Sample Output 987 654 321 369 258 147

Problem Description The set of cyclic rotations of a string are the strings obtained by embedding the string clockwise on a ring, with the first character following on the last, starting at any character position and moving clockwise on the ring until the character preceeding the starting character is reached. A string is a necklace if it is the lexicographically smallest among all its cyclic rotations. For instance, for the string 01011 the cyclic rotations are (10110,01101,11010,10101,01011), and furthermore 01011 is the smallest string and hence, a necklace. Any string S can be written in a unique way as a concatenation S = T1T2 . . . Tk of necklaces Ti such that Ti+1 < Ti for all i = 1, . . . , k - 1, and TiTi+1 is not a necklace for any i = 1, . . . , k - 1. This representation is called the necklace decomposition of the string S, and your task is to find it. The relation < on two strings is the lexicographical order and has the usual interpretation: A < B if A is a proper prefix of B or if A is equal to B in the first j - 1 positions but smaller in the jth position for some j. For instance, 001 < 0010 and 1101011 < 1101100 Input On the first line of the input is a single positive integer n, telling the number of test scenarios to follow. Each scenario consists of one line containing a non-empty string of zeros and ones of length at most 100. Output For each scenario, output one line containing the necklace decomposition of the string. The necklaces should be written as '(' necklace ')'. Sample Input 5 0 0101 0001 0010 11101111011 Sample Output (0) (0101) (0001) (001)(0) (111)(01111)(011)

Problem Description There are many gods and devils living on HDU Island, and echo is one of them. Gods always tell the truth whereas devils sometimes tell the truth but sometimes not. What's more, every god and devil knows all the others are a god or a devil. One day, an accident unfortunately happened which made echo lose her memory. She was so despairing and determined to turn to others for help. She asked all the residents a question, but all of the answers were merely "Be careful! X is a devil!". As a result she failed to arouse her memory. However, she has to find out a method to calculate the minimum number of devils on the island. Could you help echo to manage it well? Input There are multi-cases (The total number of cases won't exceed 20). First line is an integer N(1<=N<=15000), the total number of gods and devils. Then N lines follow, each line includes a name, and the length of each name won't exceed 30. The first name is "echo". The next N-1 lines will be as the formation "A says: Be careful! B is a devil!"(A is different from B), and you can assume that at least one of them will consider echo is a devil and says "Be careful! echo is a devil!". Output Output the minimum number of devils in the island. Sample Input 3 echo bigdog smalldog smalldog says: Be careful! bigdog is a devil! bigdog says: Be careful! echo is a devil! 4 echo Lethe bigdog smalldog Lethe says: Be careful! bigdog is a devil! smalldog says: Be careful! echo is a devil! bigdog says: Be careful! smalldog is a devil! Sample Output 1 2

Problem Description As we know,2012 is coming,and the presidents of many countries have planned to board the airships.We also know that every president i will bring a[i] bodyguards to make sure his safe,and he will pay b[i] billion dollars to U.N. We also know that some countries are more powerful than others,so if we have chose some countries to board the ship,we must make the powerful countries board first,and make sure that the bodyguards stay the same ship with his president. Now,U.N has m ships. And every ship can only contain k people.So cannot hold all the people,but the U.N want to make more mongey .Make the most money for the U.N,then the U.N will give Lazy Yangyang a chance to survive when 2012 is coming. Lazy Yangyang want to be safe so that he can inherit the job of ACM for the new world.To make the dream come true,the acmers of the world are solving the problem for Lady YY,and you are one of them……… Input In the first line there is an integer T, indicates the number of test cases. (T <= 10) In each case, the first line contains three integers n,m and k. (0 <m<=n <=100,0<k<100000) Then n line,every line has two integers a[i]、b[i], (0<=a[i]<100000,0<=b[i]<100)representing the bodyguards and dollars, ordered by their power,The first country is the most powerful country. Output Most money that U.N can get. Sample Input 1 4 2 400 60 1 180 1 180 1 260 1 Sample Output 3

Linux(服务器编程):15---两种高效的事件处理模式（reactor模式、proactor模式）

C语言魔塔游戏

Python爬虫爬取淘宝，京东商品信息

Java工作4年来应聘要16K最后没要,细节如下。。。

2020年，冯唐49岁：我给20、30岁IT职场年轻人的建议

1、骇客帝国(1999) 概念：在线/离线，递归，循环，矩阵等 剧情简介： 不久的将来，网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂，并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他，现实世界其实是由一个名叫“母体”的计算机人工智能系统控制，人们就像他们饲养的动物，没有自由和思想，而尼奥就是能够拯救人类的救世主。 可是，救赎之路从来都不会一帆风顺，到底哪里才是真实的世界？如何...
Python绘图，圣诞树，花，爱心 | Turtle篇

CPU对每个程序员来说，是个既熟悉又陌生的东西？ 如果你只知道CPU是中央处理器的话，那可能对你并没有什么用，那么作为程序员的我们，必须要搞懂的就是CPU这家伙是如何运行的，尤其要搞懂它里面的寄存器是怎么一回事，因为这将让你从底层明白程序的运行机制。 随我一起，来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说，我们首先就要搞明白它是怎么回事，也就是它的内部构造，当然，CPU那么牛的一个东...

2019年除夕夜的有感而发

2020年的1月，我辞掉了我的第一份工作

By 超神经场景描述：昨天 2 月 3 日，是大部分城市号召远程工作的第一天，全国有接近 2 亿人在家开始远程办公，钉钉上也有超过 1000 万家企业活跃起来。关键词：十一出行 人脸...
Java基础知识点梳理

2020年全新Java学习路线图，含配套视频，学完即为中级Java程序员！！

B 站上有哪些很好的学习资源?