{"trustable":false,"sections":[{"title":"","value":{"format":"PLAIN","content":"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:\n1. input n\n2. print n \n3. if n \u003d 1 then STOP\n4. if n is odd then n\u003d 3n+ 1\n5. else n\u003d n/2\n6. GOTO 2\nGiven the input 22, the following sequence of numbers will be printed\n22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1\nIt is conjectured that the algorithm above will terminate (when a 1 is printed) for any integral inputvalue. 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\u003c n \u003c1;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 before and includingthe 1 is printed. For a given n this is called the cycle-length of n. In the example above, the cyclelength of 22 is 16.For any two numbers i and j you are to determine the maximum cycle length over all numbersbetween and including both i and j.\n\nInput\n\nThe input will consist of a series of pairs of integers i and j , one pair of integers per line. All integerswill be less than 10,000 and greater than 0.You should process all pairs of integers and for each pair determine the maximum cycle length overall integers between and including i and j.You can assume that no operation overflows a 32-bit integer.\n\nOutput\n\nFor 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).\n\nSample Input\n\n1 10\n100 200\n201 210\n900 1000\n\nSample Output\n\n1 10 20\n100 200 125\n201 210 89\n900 1000 174\n\n计算机科学中的问题通常被划分为属于某一类问题(例如,NP,不可解,递归)。在这个问题中,你将分析一个算法的一个属性,其分类并不是对所有可能的输入都知道.考虑以下算法。\n1. 输入n\n2. 打印n \n3. 如果n\u003d1,则停止\n4.如果n是奇数,那么n\u003d 3n+1\n5. 否则n\u003dn/2\n6. GOTO 2\n给定输入22,将打印出以下数字序列。\n22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1\n据猜测,对于任何一个积分输入值,上述算法都会终止(当打印出一个1时)。 尽管该算法很简单,但这个猜想是否属实还不得而知。 然而,它已经被验证了,对于所有的整数n,如0\u003cn\u003c1;000;000(事实上,对于比这更多的数字。)给定一个输入n,可以确定在打印1之前和包括打印1在内的数字数量。 在上面的例子中,22的周期长度是16.对于任何两个数字i和j,你要确定i和j之间所有数字的最大周期长度。\n\n輸入\n\n输入将由一系列的整数对i和j组成,每行一个整数对。所有的整数将小于10,000,大于0.你应该处理所有的整数对,并为每一对确定最大的周期长度整体整数之间和包括i和j.你可以假设没有操作溢出一个32位整数。\n\n輸出\n\n对于每一对输入整数i和j,你应该输出i,j,以及i和j之间并包括i和j在内的整数的最大周期长度。 这三个数字应该至少用一个空格隔开,三个数字都在一行,每一行输入都有一行输出。整数i和j必须按照它们在输入中出现的顺序出现在输出中,并在后面跟上最大周期长度(在同一行)。\n\n输入示例\n\n1 10\n100 200\n201 210\n900 1000\n\n采样输出\n\n1 10 20\n100 200 125\n201 210 89\n900 1000 174\n\n\n\n通过www.DeepL.com/Translator(免费版)翻译"}}]}