摘要: Problem Description读入两个小于10000的正整数A和B,计算A+B。需要注意的是:如果A和B的末尾K(不超过8)位数字相同,请直接输出-1。Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A B K",相邻两数字有一个空格间隔。当A和B同时为0时输入结束,相应的结果不要输出。Output对每个测试用例输出1行,即A+B的值或者是-1。Sample Input1 2 1 11 21 1 108 8 2 36 64 3 0 0 1Sample Output3 -1-1 100题意:略!分析:a和b对10^k求模,然后判断这两个数是否相等,如果 阅读全文
posted @ 2013-03-14 19:42 刘一卜 阅读(391) 评论(0) 推荐(0)
摘要: Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.This year, they decide to l 阅读全文
posted @ 2013-03-13 19:47 刘一卜 阅读(237) 评论(0) 推荐(0)
摘要: BackgroundMcCarthy is a famous theorician of computer science. In his work, he defined a recursive function, called f91, that takes as input a positive integerNand returns a positive integer defined as follows:IfN ≤ 100, then f91(N) = f91(f91(N+11));IfN ≥ 101, then f91(N) =N-10.The ProblemWrite a pr 阅读全文
posted @ 2013-02-25 21:33 刘一卜 阅读(551) 评论(0) 推荐(0)
摘要: Someoperatorschecks about the relationship between two values and these operators are called relational operators. Given two numerical values your job is just to find out the relationship between them that is (i) First one is greater than the second (ii) First one is less than the second or (iii) Fi 阅读全文
posted @ 2013-02-25 21:30 刘一卜 阅读(242) 评论(0) 推荐(0)
摘要: It is said that 90% of frosh expect to be above average in their class. You are to provide a reality check.The first line of standard input contains an integer C, the number of test cases. C data sets follow. Each data set begins with an integer, N, the number of people in the class (1 <= N <= 阅读全文
posted @ 2013-02-25 21:27 刘一卜 阅读(333) 评论(0) 推荐(0)
摘要: Given a range[a,b], you are to find the summation of all the odd integers in this range. For example, the summation of all the odd integers in the range[3, 9]is3 + 5 + 7 + 9 = 24.InputThere can be at multiple test cases. The first line of input gives you the number of test cases,T(1T100). Then T tes 阅读全文
posted @ 2013-02-25 21:24 刘一卜 阅读(232) 评论(0) 推荐(0)
摘要: German farmers are given a premium depending on the conditions at their farmyard. Imagine the following simplified regulation: you know the size of each farmer's farmyard in square meters and the number of animals living at it. We won't make a difference between different animals, although t 阅读全文
posted @ 2013-02-25 21:21 刘一卜 阅读(245) 评论(0) 推荐(0)
摘要: A particle has initial velocity and constant acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time?InputThe input will contain two integers in each line. Each line makes one set of input. These two integers denote the value of v (-100 <= v 阅读全文
posted @ 2013-02-25 21:17 刘一卜 阅读(298) 评论(0) 推荐(0)
摘要: Hashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight against his opponents. Before fighting he just calculates one thing, the difference between his soldier number and the opponent's soldier number. From this difference he decides whether to fi 阅读全文
posted @ 2013-02-25 21:14 刘一卜 阅读(418) 评论(0) 推荐(0)
摘要: When a number is expressed in decimal, thek-th digit represents a multiple of 10k. (Digits are numbered from right to left, where the least significant digit is number 0.) For example,When a number is expressed in binary, thek-th digit represents a multiple of 2k. For example,Inskew binary, thek-th 阅读全文
posted @ 2013-02-24 13:33 刘一卜 阅读(265) 评论(0) 推荐(0)