摘要: EncodingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19071Accepted Submission(s): 8230Problem DescriptionGiven a string containing only 'A' - 'Z', we could encode it using the following method:1. Each sub-string containing k same 阅读全文
posted @ 2013-03-18 21:00 三人木君 阅读(296) 评论(0) 推荐(0) 编辑
摘要: Digital RootsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35288Accepted Submission(s): 10794Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then th 阅读全文
posted @ 2013-03-14 21:01 三人木君 阅读(3756) 评论(1) 推荐(2) 编辑
摘要: u Calculate eTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21753Accepted Submission(s): 9604Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e u 阅读全文
posted @ 2013-03-13 21:46 三人木君 阅读(166) 评论(0) 推荐(0) 编辑
摘要: ElevatorTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30095Accepted Submission(s): 16272Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floo 阅读全文
posted @ 2013-03-13 21:25 三人木君 阅读(4089) 评论(0) 推荐(0) 编辑
摘要: Number SequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 73223Accepted Submission(s): 17033Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to 阅读全文
posted @ 2013-03-13 20:43 三人木君 阅读(327) 评论(0) 推荐(0) 编辑
摘要: Let the Balloon RiseTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 50554Accepted Submission(s): 18117Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time 阅读全文
posted @ 2013-03-12 20:14 三人木君 阅读(5407) 评论(0) 推荐(2) 编辑
摘要: Problem BPeter’s SmokesInput:standard inputOutput:standard outputTime Limit:4 secondsMemory Limit:32 MBPeter hasncigarettes. He smokes them one by one keeping all the butts. Out ofk> 1butts he can roll a new cigarette.How many cigarettes can Peter have?InputInput is a sequence of lines. Each line 阅读全文
posted @ 2013-02-25 16:14 三人木君 阅读(295) 评论(0) 推荐(0) 编辑
摘要: Parentheses BalanceYou are given a string consisting of parentheses()and[]. A string of this type is said to becorrect:(a)if it is the empty string(b)if A and B are correct, AB is correct,(c)if A is correct,(A)and[A]is correct.Write a program that takes a sequence of strings of this type and check t 阅读全文
posted @ 2013-02-25 16:05 三人木君 阅读(398) 评论(0) 推荐(0) 编辑
摘要: Roman DigititisMany persons are familiar with the Roman numerals for relatively small numbers. The symbols ``i", ``v", ``x", ``l", and ``c" represent the decimal values 1, 5, 10, 50, and 100 respectively. To represent other values, these symbols, and multiples where necessar 阅读全文
posted @ 2013-02-25 15:56 三人木君 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Points in Figures: RectanglesGiven a list of rectangles and a list of points in thex-yplane, determine for each point which figures (if any) contain the point.InputThere will ben() rectangles descriptions, one per line. The first character will designate the type of figure (``r'' for rectang 阅读全文
posted @ 2013-02-25 15:42 三人木君 阅读(522) 评论(0) 推荐(0) 编辑
摘要: Odd SumGiven a range[a,b], you are to find the summation of all the odd integers in this range. For example, the summation of all the odd integers in the range[3, 9]is3 + 5 + 7 + 9 = 24.InputThere can be at multiple test cases. The first line of input gives you the number of test cases,T(1T100). The 阅读全文
posted @ 2013-02-25 15:31 三人木君 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Problem EAll in AllInput:standard inputOutput:standard outputTime Limit:2 secondsMemory Limit:32 MBYou have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss 阅读全文
posted @ 2013-02-25 15:27 三人木君 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Problem A - f91Time Limit: 1 secondBackgroundMcCarthy is a famous theorician of computer science. In his work, he defined a recursive function, called f91, that takes as input a positive integerNand returns a positive integer defined as follows:IfN ≤ 100, then f91(N) = f91(f91(N+11));IfN ≥ 101, then 阅读全文
posted @ 2013-02-25 15:16 三人木君 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Binomial ShowdownIn how many ways can you choosekelements out ofnelements, not taking order into account?Write a program to compute this number.Input SpecificationThe input file will contain one or more test cases.Each test case consists of one line containing two integersn() andk().Input is termina 阅读全文
posted @ 2013-02-25 15:12 三人木君 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Problem EPizza CuttingInput:standard inputOutput:standard outputWhen someone calls Ivan lazy, he claims that it is his intelligence that helps him to be so. If his intelligence allows him to do something at less physical effort, why should he exert more? He also claims that he always uses his brain 阅读全文
posted @ 2013-02-25 15:04 三人木君 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Street NumbersA computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her dog by leaving her house and randomly turning left or right and walking to the end of the street and back. One night she adds up the street numbe 阅读全文
posted @ 2013-02-25 00:43 三人木君 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Quirksome SquaresThe number 3025 has a remarkable quirk: if you split its decimal representation in two strings of equal length (30 and 25) and square the sum of the numbers so obtained, you obtain the original number:The problem is to determine all numbers with this property having a given even num 阅读全文
posted @ 2013-02-25 00:16 三人木君 阅读(344) 评论(0) 推荐(0) 编辑
摘要: Funny Encryption MethodThe ProblemHistory :A student from ITESM Campus Monterrey plays with a new encryption method for numbers. These method consist of the following steps:Steps : Example1) Read the number N to encrypt M = 2652) Interpret N as a decimal number X1= 265 (decimal)3) Convert the decima 阅读全文
posted @ 2013-02-25 00:07 三人木君 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 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 三人木君 阅读(250) 评论(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 三人木君 阅读(437) 评论(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 三人木君 阅读(217) 评论(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 三人木君 阅读(237) 评论(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 三人木君 阅读(338) 评论(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 三人木君 阅读(280) 评论(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 三人木君 阅读(263) 评论(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 三人木君 阅读(309) 评论(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 三人木君 阅读(164) 评论(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 三人木君 阅读(313) 评论(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 三人木君 阅读(186) 评论(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 三人木君 阅读(255) 评论(0) 推荐(0) 编辑
摘要: ClockHandsThe medieval interest in mechanical contrivances is well illustrated by the development of the mechanical clock, the oldest of which is driven by weights and controlled by a verge, an oscillating arm engaging with a gear wheel. It dates back to 1386.Clocks driven by springs had appeared by 阅读全文
posted @ 2013-02-23 05:58 三人木君 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Problem B: MinesweeperThe ProblemHave you ever played Minesweeper? It's a cute little game which comes within a certain Operating System which name we can't really remember. Well, the goal of the game is to find where are all the mines within a MxN field. To help you, the game shows a number 阅读全文
posted @ 2013-02-23 05:41 三人木君 阅读(346) 评论(0) 推荐(0) 编辑
摘要: Factors and FactorialsThe factorial of a numberN(writtenN!) is defined as the product of all the integers from 1 toN. It is often defined recursively as follows:Factorials grow very rapidly--5! = 120, 10! = 3,628,800. One way of specifying such large numbers is by specifying the number of times each 阅读全文
posted @ 2013-02-23 05:27 三人木君 阅读(326) 评论(0) 推荐(0) 编辑
摘要: It is said that 90% of frosh expect to be above average in their class. You are to provide a reality check.The first line of standard input contains an integer C, the number of test cases. C data sets follow. Each data set begins with an integer, N, the number of people in the class (1 <= N <= 阅读全文
posted @ 2013-02-23 05:10 三人木君 阅读(215) 评论(0) 推荐(0) 编辑
摘要: PerfectionFrom the article Number Theory in the 1994 Microsoft Encarta: ``Ifa,b,care integers such thata=bc, a is called a multiple ofbor ofc, andborcis called a divisor or factor ofa. Ifcis not,bis called a proper divisor ofa. Even integers, which include 0, are multiples of 2, for example, -4, 0, 阅读全文
posted @ 2013-02-23 04:35 三人木君 阅读(350) 评论(0) 推荐(0) 编辑
摘要: Power CrisisDuring the power crisis in New Zealand this winter (caused by a shortage of rain and hence low levels in the hydro dams), a contingency scheme was developed to turn off the power to areas of the country in a systematic, totally fair, manner. The country was divided up intoNregions (Auckl 阅读全文
posted @ 2013-02-23 03:03 三人木君 阅读(361) 评论(0) 推荐(0) 编辑
摘要: CombinationsComputing the exact number of ways thatNthings can be takenMat a time can be a great challenge whenNand/orMbecome very large. Challenges are the stuff of contests. Therefore, you are to make just such a computation given the following:GIVEN:Compute theEXACTvalue of:You may assume that th 阅读全文
posted @ 2013-02-23 00:50 三人木君 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Skew BinaryWhen a number is expressed in decimal, thek-th digit represents a multiple of 10k. (Digits are numbered from right to left, where the least significant digit is number 0.) For example,When a number is expressed in binary, thek-th digit represents a multiple of 2k. For example,Inskew binar 阅读全文
posted @ 2013-02-22 23:24 三人木君 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Problem AEcological PremiumInput:standard inputOutput:standard outputTime Limit:1 secondMemory Limit:32 MBGerman farmers are given a premium depending on the conditions at their farmyard. Imagine the following simplified regulation: you know the size of each farmer's farmyard in square meters an 阅读全文
posted @ 2013-02-22 22:02 三人木君 阅读(198) 评论(0) 推荐(0) 编辑
摘要: What's Cryptanalysis?Cryptanalysis is the process of breaking someone else's cryptographic writing. This sometimes involves some kind of statistical analysis of a passage of (encrypted) text. Your task is to write a program which performs a simple analysis of a given text.InputThe first line 阅读全文
posted @ 2013-02-22 20:54 三人木君 阅读(460) 评论(0) 推荐(0) 编辑