摘要: At an old railway station, you may still encounter one of the last remaining ``train swappers''. A train swapper is an employee of the railroad, whose sole job it is to rearrange the carriages of trains.Once the carriages are arranged in the optimal order, all the train driver has to do, is 阅读全文
posted @ 2013-02-24 13:29 刘一卜 阅读(425) 评论(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 刘一卜 阅读(1158) 评论(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 刘一卜 阅读(2416) 评论(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 刘一卜 阅读(3398) 评论(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 刘一卜 阅读(2479) 评论(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 刘一卜 阅读(443) 评论(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 刘一卜 阅读(1803) 评论(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 刘一卜 阅读(306) 评论(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 刘一卜 阅读(478) 评论(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 刘一卜 阅读(465) 评论(0) 推荐(0)