摘要: Train SwappingAt 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 阅读全文
posted @ 2013-02-20 23:46 三人木君 阅读(237) 评论(0) 推荐(0)
摘要: Kindergarten Counting GameEverybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and OutputInput to your program will consist of a series of lines, each line containing multiple words (at least one 阅读全文
posted @ 2013-02-20 21:48 三人木君 阅读(492) 评论(0) 推荐(0)
摘要: Power of CryptographyBackgroundCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in this area has resulted in the practical use of results from number theory and other branches of mathematics once con 阅读全文
posted @ 2013-02-20 17:42 三人木君 阅读(684) 评论(0) 推荐(0)
摘要: Maximum SumBackgroundA problem that is simple to solve in one dimension is often much more difficult to solve in more than one dimension. Consider satisfying a boolean expression in conjunctive normal form in which each conjunct consists of exactly 3 disjuncts. This problem (3-SAT) is NP-complete. T 阅读全文
posted @ 2013-02-20 17:24 三人木君 阅读(444) 评论(0) 推荐(0)
摘要: Ugly NumbersUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ...shows the first 11 ugly numbers. By convention, 1 is included.Write a program to find and print the 1500'th ugly number.Input and OutputThere is no input to this progra 阅读全文
posted @ 2013-02-20 02:51 三人木君 阅读(3599) 评论(0) 推荐(0)
摘要: Reverse and AddThe ProblemThe "reverse and add" method is simple: choose a number, reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right and right to left), repeat this procedure.For example: 195 Initial num 阅读全文
posted @ 2013-02-20 02:06 三人木君 阅读(474) 评论(0) 推荐(0)