中国大学生程序设计竞赛- 女生专场 杭州
Problem1001.Solving Order
Input?le:stdin
Output?le:stdout
Time limit:1seconds
Memory limit:32megabytes
Welcome to HDU to take part in the?rst CCPC girls’competition!
As a pretty special competition,many volunteers are preparing for it with high enthusiasm.
One thing they need to do is blowing the balloons.
Before sitting down and starting the competition,you have just passed by the room where the boys are blowing the balloons.And you have found that the number of balloons of di?erent colors are strictly di?erent.
After thinking about the volunteer boys’sincere facial expressions,you noticed that,the problem with more balloon numbers are sure to be easier to solve.
Now,you have recalled how many balloons are there of each color.
Please output the solving order you need to choose in order to?nish the problems from easy to hard.
You should print the colors to represent the problems.
Input
The?rst line is an integer T which indicates the case number.
And as for each case,the?rst line is an integer n,which is the number of problems.
Then there are n lines followed,with a string and an integer in each line,in the i-th line,the string means the color of ballon for the i-th problem,and the integer means the ballon numbers.
It is guaranteed that:
T is about100.
1≤n≤10.
1≤string length≤10.
1≤bolloon numbers≤83.(there are83teams:p)
For any two problems,their corresponding colors are di?erent.
For any two kinds of balloons,their numbers are di?erent.
Output
For each case,you need to output a single line.
There should be n strings in the line representing the solving order you choose.
Please make sure that there is only a blank between every two strings,and there is no extra blank.
Examples
stdin stdout
3
3
red1 green2 yellow3 1
blue83 2
red2 white1yellow green red blue
red white
Problem1002.Desert
Input?le:stdin
Output?le:stdout
Time limit:1seconds
Memory limit:32megabytes
A tourist gets lost in the desert with n liters of water.He drinks positive integer units of water each day.
Write a program to calculate how many di?erent ways the tourist can drink up the water.
Input
The?rst line contains the number of test cases T(T≤10).
Next T lines contain the number n(1≤n≤1000000)for each test case.
Output
Output consists of T lines.
Each line contains the binary number which represents number of di?erent ways to?nish up the water speci?ed in the test case.
Examples
stdin stdout
100
1
3
3liters of water can be comsumed in four di?erent ways show in the following.
1.111
2.12
3.21
4.3
If we write4in binary,it’s100.
Problem1003.Luck Competition
Input?le:stdin
Output?le:stdout
Time limit:1seconds
Memory limit:32megabytes
Participants of the Luck Competition choose a non-negative integer no more than100in their mind. After choosing their number,let K be the average of all numbers,and M be the result of K×2
3
.Then the lucky person is the one who choose the highest number no more than M.If there are several such people,the lucky person is chosen randomly.
If you are given a chance to know how many people are participating the competition and what their numbers are,calculate the highest number with the highest probability to win assuming that you’re joining the competition.
Input
There are several test cases and the?rst line contains the number of test cases T(T≤10).
Each test case begins with an integer N(1 Output For each test case,output an integer which you have chosen and the probability of winning(round to two digits after the decimal point),seperated by space. Examples stdin stdout 3 4 123 4 112 4 20304010.50 01.00 181.00 Input?le:stdin Output?le:stdout Time limit:1seconds Memory limit:64megabytes Given a time HH:MM:SS and one parameter a,you need to calculate next time satisfying following conditions: 1.The angle formed by the hour hand and the minute hand is a. 2.The time may not be a integer(e.g.12:34:56.78),rounded down(the previous example12:34:56). Input The input contains multiple test cases. Each test case contains two lines. The?rst line is the time HH:MM:SS(0≤HH<12,0≤MM<60,0≤SS<60). The second line contains one integer a(0≤a≤180). Output For each test case,output a single line contains test case number and the answer HH:MM:SS. Examples stdin stdout 0:59:59 30 01:00:00 30Case#1:01:00:00 Case#2:01:10:54 Input?le:stdin Output?le:stdout Time limit:1seconds Memory limit:32megabytes As a cute girl,Kotori likes playing“Hide and Seek”with cats particularly. Under the in?uence of Kotori,many girls and cats are playing“Hide and Seek”together. Koroti shots a photo.The size of this photo is n×m,each pixel of the photo is a character of the lowercase(from‘a’to‘z’). Kotori wants to know how many girls and how many cats are there in the photo. We de?ne a girl as–we choose a point as the start,passing by4di?erent connected points contin-uously,and the four characters are exactly“girl”in the order. We de?ne two girls are di?erent if there is at least a point of the two girls are di?erent. We de?ne a cat as–we choose a point as the start,passing by3di?erent connected points contin-uously,and the three characters are exactly“cat”in the order. We de?ne two cats are di?erent if there is at least a point of the two cats are di?erent. Two points are regarded to be connected if and only if they share a common edge. Input The?rst line is an integer T which represents the case number. As for each case,the?rst line are two integers n and m,which are the height and the width of the photo. Then there are n lines followed,and there are m characters of each line,which are the the details of the photo. It is guaranteed that: T is about50. 1≤n≤1000. 1≤m≤1000. ∑ (n×m)≤2×106. Output As for each case,you need to output a single line. There should be2integers in the line with a blank between them representing the number of girls and cats respectively. Please make sure that there is no extra blank. Examples stdin stdout 3 14 girl 23 oto cat 34 girl hrlt hlca 10 02 41 https://www.360docs.net/doc/f311194696.html,bine String Input?le:stdin Output?le:stdout Time limit:1seconds Memory limit:64megabytes Given three strings a,b and c,your mission is to check whether c is the combine string of a and b. A string c is said to be the combine string of a and b if and only if c can be broken into two subsequences,when you read them as a string,one equals to a,and the other equals to b. For example,“adebcf”is a combine string of“abc”and“def”. Input Input?le contains several test cases(no more than20).Process to the end of?le. Each test case contains three strings a,b and c(the length of each string is between1and2000). Output For each test case,print“Yes”,if c is a combine string of a and b,otherwise print“No”. Examples stdin stdout abc def adebcf abc def abecdf Yes No Problem1007.Alice and Bob Input?le:stdin Output?le:stdout Time limit:1seconds Memory limit:64megabytes Alice and Bob are playing a stone game in a board of n×m cells. In the begining,the stone is in the upperleft cell.And in each turn,they can move the stone one cell to the right or one cell down,or diagonally k cells down to the right,which means if you are at(x,y), then you could move into(x+1,y),(x,y+1)or(x+k,y+k)at the next step.The player who can not move loses.They play in turns and Alice moves?rst. Now given n,m and k,could you tell me who is the winner? Input First line contains an integer T(1≤T≤10),denoting the number of test cases. In each test case,the?rst line is two integers Q and k. In the following Q lines,each line contains n and m.(1≤Q≤1000,1≤k,n,m≤109) Output For each test case,output Q lines. If Alice is the winner,output“Alice”.Otherwise“Bob”. Examples stdin stdout 2 21 45 34 2 3 45 56Alice Alice Alice Bob Problem1008.Claris Loves Painting Input?le:stdin Output?le:stdout Time limit:5seconds Memory limit:256megabytes Claris loves painting very much,so he painted a tree with beautiful colors. The tree is a rooted tree with n nodes which are conveniently labeled by1,2,...,n.Its root is the 1-st node,and the i-th node is painted with color c i.If c i=c j,then we think these two nodes have the same color. We de?ne depth i as the distance between the i-th node and the root,and simply,the distance between two adjacent nodes is always1. Standing in front of this beautiful tree,Claris comes up with m questions. In each question,there are two integers x and d,which means that Claris wants to know the number of di?erent kinds of colors occur in S,where S={v|v in x′s subtree and depth v≤depth x+d}. Input The?rst line of the input contains an integer T(1≤T≤500),denoting the number of test cases. In every test case,there are two integers n(1≤n≤100000)and m(1≤m≤100000)in the?rst line,denoting the number of nodes and queries. The second line contains n integers,the i-th integer c i(1≤c i≤n)denotes the color of the i-th node. The third line contains n?1integers,the i-th integer f i+1(1≤f i