随笔分类 -  POJ

POJ的题目
摘要:取石子游戏 Time Limit: 1000MS Memory Limit: 10000K Description 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 Input 输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大于1,000,000,000。 Output 输出对应也有若干行,每行包含一个数字1或0,如果最后你是胜者,则为1,反之,则为0。 阅读全文
posted @ 2013-03-03 17:39 Cocoon 阅读(216) 评论(0) 推荐(0)
摘要:Big Number Time Limit: 1000MS Memory Limit: 65536K Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number. Input Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n line 阅读全文
posted @ 2013-03-03 14:46 Cocoon 阅读(199) 评论(0) 推荐(0)
摘要:The 3n + 1 problem Time Limit: 1000MS Memory Limit: 10000K Description Problems 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 algorithm: 1. input n 2. print n 3. if n = 1 then STOP 4. if n is odd then n 阅读全文
posted @ 2013-03-02 19:10 Cocoon 阅读(605) 评论(0) 推荐(0)
摘要:THE DRUNK JAILER Time Limit: 1000MS Memory Limit: 10000K Description A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked. One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink of whiskey,and then runs down the hall unlocking each cell. For round 2, he takes a drink of whiskey, and then runs down the hall locking every other cell (c 阅读全文
posted @ 2013-03-02 00:14 Cocoon 阅读(448) 评论(0) 推荐(0)