摘要: Problem C: Vito's familyBackgroundThe world-known gangster Vito Deadstone is moving to New York. He has a very big family there, all of them living in Lamafia Avenue. Since he will visit all his relatives very often, he is trying to find a house close to them.ProblemVito wants to minimize the to 阅读全文
posted @ 2013-02-24 23:55 三人木君 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Word ScrambleWrite a program that will reverse the letters in each of a sequence of words while preserving the order of the words themselves.InputThe input file will consist of several lines of several words. Words are contiguous stretches of printable characters delimited by white space.OutputThe o 阅读全文
posted @ 2013-02-24 23:40 三人木君 阅读(435) 评论(0) 推荐(0) 编辑
摘要: Fibonacci FreezeThe Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) are defined by the recurrence:Write a program to calculate the Fibonacci Numbers.Input and OutputThe input to your program would be a sequence of numbers smaller or equal than 5000, each on a separate line, specifying w 阅读全文
posted @ 2013-02-24 23:35 三人木君 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Goldbach's Conjecture (II)Goldbach's Conjecture:For any even numberngreater than or equal to 4, there exists at least one pair of prime numbersp1andp2such thatn=p1+p2.This conjecture has not been proved nor refused yet. No one is sure whether this conjecture actually holds. However, one can 阅读全文
posted @ 2013-02-24 22:47 三人木君 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Big ModCalculatefor large values ofB,P, andMusing an efficient algorithm. (That's right, this problem has a time dependency !!!.)InputThree integer values (in the orderB,P,M) will be read one number per line.BandPare integers in the range 0 to 2147483647 inclusive.Mis an integer in the range 1 t 阅读全文
posted @ 2013-02-24 22:31 三人木君 阅读(335) 评论(0) 推荐(0) 编辑
摘要: What is the Median?The ProblemMedian plays an important role in the world of statistics. By definition, it is a value which divides an array into two equal parts. In this problem you are to determine the current median of some long integers.Suppose, we have five numbers {1,3,6,2,7}. In this case, 3 阅读全文
posted @ 2013-02-24 22:26 三人木君 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Goldbach's ConjectureIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every number greater than 2 can be written as the sum of three prime numbers.Goldbach cwas considering 1 as a primer number, a convention th 阅读全文
posted @ 2013-02-24 22:13 三人木君 阅读(254) 评论(0) 推荐(0) 编辑
摘要: Error CorrectionA boolean matrix has theparity propertywhen each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property:1 0 1 00 0 0 01 1 1 10 1 0 1The sums of the rows are 2, 0, 4 and 2. The sums of the column 阅读全文
posted @ 2013-02-24 22:06 三人木君 阅读(305) 评论(0) 推荐(0) 编辑
摘要: Light, more lightThe ProblemThere is man named "mabu" for switching on-off light in our University. He switches on-off the lights in a corridor. Every bulb has its own toggle switch. That is, if it is pressed then the bulb turns on. Another press will turn it off. To save power consumption 阅读全文
posted @ 2013-02-24 21:58 三人木君 阅读(163) 评论(0) 推荐(0) 编辑
摘要: What's The Frequency, Kenneth?#include <stdio.h>main(){ int i; char *suffix[]= { "st", "nd", "rd" }; char *item[]= { "Unix" , "cat", "sed", "awk", "grep", "ed", "vi"}; printf("In the be 阅读全文
posted @ 2013-02-24 21:30 三人木君 阅读(310) 评论(0) 推荐(0) 编辑
摘要: Integer InquiryOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see the 阅读全文
posted @ 2013-02-24 21:20 三人木君 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Count on CantorOne of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enumerable. The proof works by using an explicit enumeration of rational numbers as shown in the diagram below.In the above diagram, the first term is 1/1, the second 阅读全文
posted @ 2013-02-24 21:13 三人木君 阅读(253) 评论(0) 推荐(0) 编辑