随笔分类 -  HDU--ACM

摘要:Problem Description某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、一至三报数直到剩下的人数不超过三人为止。Input本题有多个测试数据组,第一行为组数N,接着为N行新兵人数,新兵人数不超过5000。Output共有N行,分别对应输入的新兵人数,每行输出剩下的新兵最初的编号,编号之间有一个空格。Sample Input22040Sample Outp 阅读全文
posted @ 2013-05-14 02:12 刘一卜 阅读(703) 评论(0) 推荐(0) 编辑
摘要:Problem Description大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上! 你的任务是: 计算方程x^2+y^2+z^2= num的一个正整数解。Input输入数据包含多个测试实例,每个实例占一行,仅仅包含一个小于等于10000的正整数num。Output对于每组测试数据,请按照x,y,z递增的顺序输出它的一个最小正整数解,每个实例的输出占一行,题目保证所有测试数据都有解。Sample Input3Sample Output1 1 1Authorlcy题意:略。分析:题目有两个地方将问题简化了,只求正整数解,并且只求一个就可以了。巧妙的方 阅读全文
posted @ 2013-05-09 14:49 刘一卜 阅读(370) 评论(0) 推荐(0) 编辑
摘要:Problem Description8600的手机每天消费1元,每消费K元就可以获赠1元,一开始8600有M元,问最多可以用多少天?Input输入包括多个测试实例.每个测试实例包括2个整数M, k,(2 <= k <= M <= 1000).M = 0, k = 0代表输入结束.Output对于每个测试实例输出一个整数,表示M元可以用的天数。Sample Input2 24 30 0Sample Output35题意:中文题目,就不多说了,略。分析:水题,看代码吧。AC源代码(C语言): 1 #include<stdio.h> 2 3 int main() 4 阅读全文
posted @ 2013-05-03 10:24 刘一卜 阅读(344) 评论(0) 推荐(0) 编辑
摘要:Problem Description每天第一个到机房的人要把门打开,最后一个离开的人要把门关好。现有一堆杂乱的机房签 到、签离记录,请根据记录找出当天开门和关门的人。Input测试输入的第一行给出记录的总天数N ( > 0 )。下面列出了N天的记录。 每天的记录在第一行给出记录的条目数M ( > 0 ),下面是M行,每行的格式为证件号码 签到时间 签离时间其中时间按“小时:分钟:秒钟”(各占2位)给出,证件号码是长度不超过15的字符串。Output对每一天的记录输出1行,即当天开门和关门人的证件号码,中间用1空格分隔。 注意:在裁判的标准测试输入中,所有记录保证完整,每个人的签到 阅读全文
posted @ 2013-04-26 01:11 刘一卜 阅读(873) 评论(0) 推荐(0) 编辑
摘要:Digital RootsProblem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. 阅读全文
posted @ 2013-04-23 20:17 刘一卜 阅读(377) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.OutputOutput the approximations of e generated by the above formula for the values of n from 0 to 9. The begi... 阅读全文
posted @ 2013-04-11 17:13 刘一卜 阅读(487) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The 阅读全文
posted @ 2013-04-11 13:32 刘一卜 阅读(742) 评论(0) 推荐(0) 编辑
摘要:Problem Description读入N名学生的成绩,将获得某一给定分数的学生人数输出。Input测试输入包含若干测试用例,每个测试用例的格式为第1行:N第2行:N名学生的成绩,相邻两数字用一个空格间隔。第3行:给定分数当读到N=0时输入结束。其中N不超过1000,成绩分数为(包含)0到100之间的一个整数。Output对每个测试用例,将获得给定分数的学生人数输出。Sample Input3 80 60 9060 2 85 66 05 60 75 90 55 7575 0Sample Output102 题意:略!分析:运用数组,将给定的分数与数组中存储的数据相比较即可。AC源代码(C语言 阅读全文
posted @ 2013-03-14 19:46 刘一卜 阅读(212) 评论(0) 推荐(0) 编辑
摘要: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 刘一卜 阅读(384) 评论(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 刘一卜 阅读(228) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs.Consider the following algor. 阅读全文
posted @ 2013-02-24 13:26 刘一卜 阅读(1152) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one 阅读全文
posted @ 2013-01-29 16:37 刘一卜 阅读(2394) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionYour task is to Calculate the sum of some integers.InputInput contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.OutputFor each g 阅读全文
posted @ 2013-01-29 16:25 刘一卜 阅读(3390) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.OutputFor each pair of input intege 阅读全文
posted @ 2013-01-29 16:13 刘一卜 阅读(2471) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionYour task is to Calculate a + b.InputInput contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the su 阅读全文
posted @ 2013-01-24 22:46 刘一卜 阅读(435) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionYour task is to Calculate a + b. Too easy?! Of course! I specially designed the problem for acm beginners. You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.InputThe input will consist of a series of p 阅读全文
posted @ 2013-01-24 22:40 刘一卜 阅读(1797) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionIgnatius was born in a leap year, so he want to know when he could hold his birthday party. Can you tell him?Given a positive integers Y which indicate the start year, and a positive integer N, your task is to tell the Nth leap year from year Y.Note: if year Y is a leap year, t... 阅读全文
posted @ 2013-01-24 22:35 刘一卜 阅读(299) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionLarry graduated this year and finally has a job. He’s making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what’s been going on with 阅读全文
posted @ 2013-01-24 22:20 刘一卜 阅读(472) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm clim 阅读全文
posted @ 2013-01-13 20:36 刘一卜 阅读(455) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionThese days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.Give you some integers, your task is to sort these number ascending (升序).You should know how easy the proble 阅读全文
posted @ 2013-01-13 20:05 刘一卜 阅读(1326) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示