EasyChCh commited on
Commit
83e68c7
·
verified ·
1 Parent(s): 6f8c58e

Delete 100.txt

Browse files
Files changed (1) hide show
  1. 100.txt +0 -59
100.txt DELETED
@@ -1,59 +0,0 @@
1
-
2
-
3
- ## Page 1
4
-
5
- 100
6
- The 3n + 1 problem
7
- Problems in Computer Science are often classified as belonging to a certain class of problems (e.g.,
8
- NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose
9
- classification is not known for all possible inputs.
10
- Consider the following algorithm:
11
- 1.
12
- input n
13
- 2.
14
- print n
15
- 3.
16
- if n = 1 then STOP
17
- 4.
18
- if n is odd then n ←−3n + 1
19
- 5.
20
- else n ←−n/2
21
- 6.
22
- GOTO 2
23
- Given the input 22, the following sequence of numbers will be printed
24
- 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
25
- It is conjectured that the algorithm above will terminate (when a 1 is printed) for any integral input
26
- value. Despite the simplicity of the algorithm, it is unknown whether this conjecture is true. It has
27
- been verified, however, for all integers n such that 0 < n < 1, 000, 000 (and, in fact, for many more
28
- numbers than this.)
29
- Given an input n, it is possible to determine the number of numbers printed before and including
30
- the 1 is printed. For a given n this is called the cycle-length of n. In the example above, the cycle
31
- length of 22 is 16.
32
- For any two numbers i and j you are to determine the maximum cycle length over all numbers
33
- between and including both i and j.
34
- Input
35
- The input will consist of a series of pairs of integers i and j, one pair of integers per line. All integers
36
- will be less than 10,000 and greater than 0.
37
- You should process all pairs of integers and for each pair determine the maximum cycle length over
38
- all integers between and including i and j.
39
- You can assume that no operation overflows a 32-bit integer.
40
- Output
41
- For each pair of input integers i and j you should output i, j, and the maximum cycle length for integers
42
- between and including i and j. These three numbers should be separated by at least one space with all
43
- three numbers on one line and with one line of output for each line of input. The integers i and j must
44
- appear in the output in the same order in which they appeared in the input and should be followed by
45
- the maximum cycle length (on the same line).
46
- Sample Input
47
- 1 10
48
- 100 200
49
- 201 210
50
- 900 1000
51
-
52
-
53
- ## Page 2
54
-
55
- Sample Output
56
- 1 10 20
57
- 100 200 125
58
- 201 210 89
59
- 900 1000 174