1001 A+B Format (20)(20 分) Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Each input file contains one test case. Each case…
1054 求平均值 (20)(20 分) 本题的基本要求非常简单:给定N个实数,计算它们的平均值.但复杂的是有些输入数据可能是非法的.一个"合法"的输入是[-1000,1000]区间内的实数,并且最多精确到小数点后2位.当你计算平均值的时候,不能把那些非法的数据算在内. 输入格式: 输入第一行给出正整数N(<=100).随后一行给出N个实数,数字间以一个空格分隔. 输出格式: 对每个非法输入,在一行中输出"ERROR: X is not a legal number&q…
A1027 Colors in Mars (20)(20 分) People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and…
1046 Shortest Distance (20)(20 分)提问 The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits. Input Specification: Each input file contains one test cas…
1011 World Cup Betting (20)(20 分)提问 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, footb…
1049 数列的片段和(20)(20 分) 给定一个正数数列,我们可以从中截取任意的连续的几个数,称为片段.例如,给定数列{0.1, 0.2, 0.3, 0.4},我们有(0.1) (0.1, 0.2) (0.1, 0.2, 0.3) (0.1, 0.2, 0.3, 0.4) (0.2) (0.2, 0.3) (0.2, 0.3, 0.4) (0.3) (0.3, 0.4) (0.4) 这10个片段. 给定正整数数列,求出全部片段包含的所有的数之和.如本例中10个片段总和是0.1 0.3 + 0…
1033 旧键盘打字(20)(20 分) 旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现.现在给出应该输入的一段文字.以及坏掉的那些键,打出的结果文字会是怎样? 输入格式: 输入在2行中分别给出坏掉的那些键.以及应该输入的文字.其中对应英文字母的坏键以大写给出:每段文字是不超过10^5^个字符的串.可用的字符包括字母[a-z, A-Z].数字0-9.以及下划线"_"(代表空格).","."."."-".&qu…
1019 数字黑洞 (20)(20 分) 给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到一个新的数字.一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫Kaprekar常数. 例如,我们从6767开始,将得到 7766 - 6677 = 1089\ 9810 - 0189 = 9621\ 9621 - 1269 = 8352\ 8532 - 2358 = 6174\ 7641 - 146…
1018 锤子剪刀布 (20)(20 分) 大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜.平.负次数,并且给出双方分别出什么手势的胜算最大. 输入格式: 输入第1行给出正整数N(<=10^5^),即双方交锋的次数.随后N行,每行给出一次交锋的信息,即甲.乙双方同时给出的的手势.C代表“锤子”.J代表“剪刀”.B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格. 输出格式: 输出第1.2行分别给出甲.乙的胜.平.负次数…
1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, footbal…