1、08年acm浙江省题目一、Accurately Say CocaCola!Time limit: 1 Seconds Memory limit: 32768K Total Submit: 226 Accepted Submit: 132 In a party held by CocaCola company, several students stand in a circle and play a game. One of them is selected as the first, and should say the number 1. Then they continue to cou
2、nt number from 1 one by one (clockwise). The game is interesting in that, once someone counts a number which is a multiple of 7 (e.g. 7, 14, 28, .) or contains the digit 7 (e.g. 7, 17, 27, .), he shall say CocaCola instead of the number itself. For example, 4 students play this game. At some time, t
3、he first one says 25, then the second should say 26. The third should say CocaCola because 27 contains the digit 7. The fourth one should say CocaCola too, because 28 is a multiple of 7. Then the first one says 29, and the game goes on. When someone makes a mistake, the game ends. During a game, you
4、 may hear a consecutive of p CocaColas. So what is the minimum number that can make this situation happen? For example p = 2, that means there are a consecutive of 2 CocaColas. This situation happens in 27-28 as stated above. 27 is then the minimum number to make this situation happen. Input Standar
5、d input will contain multiple test cases. The first line of the input is a single integer T (1 = T = 100) which is the number of test cases. And it will be followed by T consecutive test cases. There is only one line for each case. The line contains only one integer p (1 = p = 99). Output Results sh
6、ould be directed to standard output. The output of each test case should be a single integer in one line, which is the minimum possible number for the first of the p CocaColas stands for. Sample Input 223Sample Output 2770二、Build The Electric SystemTime limit: 1 Seconds Memory limit: 32768K Total Su
7、bmit: 198 Accepted Submit: 75 In last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main power grid. The government wants to reconstruct the electric system as soon as possible.
8、 So, as a professional programmer, you are asked to write a program to calculate the minimum cost to reconstruct the power lines to make sure theres at least one way between every two villages. InputStandard input will contain multiple test cases. The first line of the input is a single integer T (1
9、 = T = 50) which is the number of test cases. And it will be followed by T consecutive test cases. In each test case, the first line contains two positive integers N and E (2 = N = 500, N = E = N * (N - 1) / 2), representing the number of the villages and the number of the original power lines betwe
10、en villages. There follow E lines, and each of them contains three integers, A, B, K (0 = A, B N, 0 = K ajx0+bj for all j != i. Now, your task is, given the set of rainbows drawn, figure out the number of rainbows that can be seen. InputStandard input will contain multiple test cases. The first line
11、 of the input is a single integer T (1 = T = 60) which is the number of test cases. And it will be followed by T consecutive test cases. Theres a blank line before every case. In each test case, there will first be an integer n (1 = n = 5000), which is the number of rainbows. Then n consecutive real
12、 number pairs follow. Each pair contains two real numbers, ai and bi, representing rainbow Li: y=aix+bi. No two rainbows will be the same, that is to say, have the same a and b. OutputResults should be directed to standard output. The output of each test case should be a single integer, which is the
13、 number of rainbows that can be seen. Sample Input 211 131 02 03 0Sample Output 12四、Difference GameTime limit: 1 Seconds Memory limit: 32768K Total Submit: 0 Accepted Submit: 0 Now you are going to play an interesting game. In this game, you are given two groups of distinct integers and C coins. The
14、 two groups, named Ga and Gb respectively, are not empty and contain the same number of integers at first. Each time you can move one integer in one group to the other group. But a move that makes a group empty is considered as invalid. Each move will cost you p coins, and p equals the difference of
15、 the size between the two group (take the absolute value. e.g. moving a number from the group of size 4 to the group of size 6 will cost you |4 - 6| = 2 coins, and moving a number between two group with same size will not cost any coins). You can do as many moves as you wish, so long as the total co
16、st does not exceed C. Let M be the minimum integer in Ga, and N be the maximum integer in Gb. The purpose of this game is to produce a maximum (M - N). Input Standard input will contain multiple test cases. The first line of the input is a single integer T (1 = T = 60) which is the number of test ca
17、ses. And it will be followed by T consecutive test cases. Each case begin with two integers S (1 = S = 20000, indicating the size of Ga and Gb at first) and C (0 = C =1 and C is a constant. (3) (f1(x)+f2(x)=(f1(x)+(f2(x). It is easy to prove that the derivation a polynomial is also a polynomial. Her
18、e comes the problem, given a polynomial f(x) with non-negative coefficients, can you write a program to calculate the derivation of it? InputStandard input will contain multiple test cases. The first line of the input is a single integer T (1 = T = 1000) which is the number of test cases. And it wil
19、l be followed by T consecutive test cases. There are exactly 2 lines in each test case. The first line of each test case is a single line containing an integer N (0 = N = 100). The second line contains N + 1 non-negative integers, CN, CN-1, ., C1, C0, ( 0 = Ci = 1000), which are the coefficients of
20、f(x). Ci is the coefficient of the term with degree i in f(x). (CN!=0) OutputFor each test case calculate the result polynomial g(x) also in a single line. (1) If g(x) = 0 just output integer 0.otherwise (2) suppose g(x)= Cmxm+Cm-1x(m-1)+.+C0 (Cm!=0),then output the integers Cm,Cm-1,.C0.(3) There is
21、 a single space between two integers but no spaces after the last integer. Sample Input301023 2 1310 0 1 2Sample Output06 230 0 1 六、Faster, Higher, StrongerTime limit: 1 Seconds Memory limit: 32768K Total Submit: 205 Accepted Submit: 145 In the year 2008, the 29th Olympic Games will be held in Beiji
22、ng. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.The motto of Olympic Games is Citius, Altius, Fortius, which means Faster, Higher, Stronger.In this problem, there are some records in the Olympic Games. Your task is to find
23、out which one is faster, which one is higher and which one is stronger.InputStandard input will contain multiple test cases. The first line of the input is a single integer T (1 = T = 50) which is the number of test cases. And it will be followed by T consecutive test cases. Each test case has 3 lin
24、es. The first line is the type of the records, which can only be Faster Higher or Stronger. The second line is a positive integer N meaning the number of the records in this test case. The third line has N positive integers, i.e. the records data. All the integers in this problem are smaller than 2008.OutputResults should be directed to sta
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1