摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文