Скачати 14.94 Kb.
Problem B: Zeros and Ones
Output: standard output
Problem A: 3n + 1
Output: standart output
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
6. GOTO 2
Given the input 22, the following sequence of numbers will be printed 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
It is conjectured that the algorithm above will terminate (when a 1 is printed) for any integral input value. Despite the simplicity of the algorithm, it is unknown whether this conjecture is true. It has been verified, however, for all integers n such that 0 < n < 1,000,000 (and, in fact, for many more numbers than this.)
Given an input n, it is possible to determine the number of numbers printed (including the 1). For a given n this is called the cycle-length of n. In the example above, the cycle length of 22 is 16.
For any two numbers i and j you are to determine the maximum cycle length over all numbers between i and j.
The input will consist of a series of pairs of integers i and j, one pair of integers per line. All integers will be less than 1,000,000 and greater than 0.
You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.
You can assume that no operations overflows a 32-bit integer.
For each pair of input integers i and j you should output i, j, and the maximum cycle length for integers between and including i and j. These three numbers should be separated by at least one space with all three numbers on one line and with one line of output for each line of input. The integers i and j must appear in the output in the same order in which they appeared in the input and should be followed by the maximum cycle length (on the same line).
Output: standard output
Time Limit: 2 seconds
Given a string of 0's and 1's up to 1000000 characters long and indices i and j, you are to answer a question whether all characters between position min(i,j) and position max(i,j) (inclusive) are the same.
There are multiple cases on input. The first line of each case gives a string of 0's and 1's. The next line contains a positive integer n giving the number of queries for this case. The next n lines contain queries, one per line. Each query is given by two non-negative integers, i and j. For each query, you are to print Yes if all characters in the string between position min(i,j) and position max(i,j) are the same, and No otherwise.
Each case on output should start with a heading as in the sample below. The input ends with an empty string that is a line containing only the new line character, this string should not be processed. The input may also with end of file. So keep check for both.
Problem C : Teobaldo's Trip
Time Limit: 1 second
Teobaldo works for the Brazilian government. In his job, he travels a lot. When Teolbaldo travels from a city S to a city E he can spend up to D days in the trip.
As Teobaldo doesn't like to work, he always spend the maximum number of days in his trips. In each day of his trip, Teobaldo sleeps in a different city from the previous day, because he thinks it is boring to stay in the same city two consecutive days.
In this problem, you should help Teobaldo to schedule his trips.
The input file contains several input sets. The description of each set is given below:
Each set starts with two integers C (0 < C ? 100), the number of cities, and L (0 ? L ? 500), the number of links between the cities. Follow L lines, where each line has two numbers: A and B (1 ? A,B ? C), meaning there is a link between these two cities. You can assume that A and B are different numbers. After the L lines, there are three integers: S,E and D. Where S is the city where the trip must start, E is the city where the trip must end, and D (0 ? D ? 200) is the maximum number of days for Teobaldo to go from S to E.
Input is terminated by a set where C=L=0. This set should not be processed. There is a blank line between two input sets.
For each input set produce one line of output, indicating if Teobaldo can travel how he wishes. See the examples below for the exact input/output format.
|Input: 3n in Output: standart output||Environmental stochastic input-output model and its deterministic equivalent|
|Texts for tests Hardware. Input/Output hardware||Output and Inflation: Are We Mismeasuring Them? The "cpi inflation" and "Chain-Weight gdp" Debates|
1. /Дерматовенерология/standart dermat.doc
|Energy analysis of periodic processes in circuit rl at nonharmonic input voltage|
Аннотация. Дан энергетический анализ периодических процессов в цепи rl с изменяющимися параметрами на основе компонент полной мощности...
1. /Ф_нансове право Украхни - Косаняк/Автореферати/239.doc