10035 - Primary Arithmetic

摘要: Children are taught to add multi-digit numbers from right-to-left one digit at a time. Many find the "carry" operation - in which a 1 is carried from one digit position to be added to the next - to be a significant challenge. Your job is to count the number of carry operations for each of 阅读全文
posted @ 2013-02-03 23:10 喂喂还债啦 阅读(1081) 评论(0) 推荐(0) 编辑

10038 - Jolly Jumpers

摘要: A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance,1 4 2 3is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies that any s 阅读全文
posted @ 2013-02-03 11:19 喂喂还债啦 阅读(267) 评论(0) 推荐(0) 编辑

102 - Ecological Bin Packing

摘要: BackgroundBin packing, or the placement of objects of certain weights into different bins subject to certain constraints, is an historically interesting problem. Some bin packing problems are NP-complete but are amenable to dynamic programming solutions or to approximately optimal heuristic solution 阅读全文
posted @ 2013-02-03 09:41 喂喂还债啦 阅读(345) 评论(0) 推荐(0) 编辑

100 - The 3n + 1 problem

摘要: BackgroundProblems 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.The ProblemConsider the following algo 阅读全文
posted @ 2013-02-01 09:45 喂喂还债啦 阅读(151) 评论(0) 推荐(0) 编辑

494 - Kindergarten Counting Game

摘要: Everybody 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). A ``word'' is d 阅读全文
posted @ 2013-01-31 15:41 喂喂还债啦 阅读(289) 评论(0) 推荐(0) 编辑

694 - The Collatz Sequence

摘要: An algorithm given by Lothar Collatz produces sequences of integers, and is described as follows:Step 1:Choose an arbitrary positive integer A as the first item in the sequence.Step 2:If A = 1 then stop.Step 3:If A is even, then replace A by A / 2 and go to step 2.Step 4:If A is odd, then replace A 阅读全文
posted @ 2013-01-31 15:09 喂喂还债啦 阅读(427) 评论(0) 推荐(0) 编辑

458 - The Decoder

摘要: Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution 阅读全文
posted @ 2013-01-30 21:06 喂喂还债啦 阅读(284) 评论(0) 推荐(0) 编辑

10071 - Back to High School Physics

摘要: 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-01-30 20:41 喂喂还债啦 阅读(146) 评论(0) 推荐(0) 编辑

10019 - Funny Encryption Method

摘要: The ProblemHistory : A student from ITESM Campus Monterrey plays with a new encryption method for numbers. These method consist of the following steps:Steps : Example 1) Read the number N to encrypt M = 265 2) Interpret N as a decimal number X1= 265 (decimal) 3) Convert the decimal interpretation of 阅读全文
posted @ 2013-01-30 20:18 喂喂还债啦 阅读(232) 评论(0) 推荐(0) 编辑

10055 - Hashmat the Brave Warrior

摘要: 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-01-30 20:18 喂喂还债啦 阅读(137) 评论(0) 推荐(0) 编辑