Pro.ID22257 TitleJohnny Hates Number Theory Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22257 AC0 Submit0 Ratio- 时间&空间限制描述Johnny hates Number Theory! Actually, back in 2002, we came to know that Johnny couldn’t count and in 2005 we knew that Johnny couldn’t yet add. (But we did know in 2003 that Johnny was street smart enough to solve difficult graph problems!) Why Johnny decided to study Number Theory is incomprehensible to us.
The following table illustrates p(n) for the first twenty positive integers:
Given two positive integers a and b where a ≤ b, Johnny defines his very own Totient function ϕ (a, b) as follows:
For example, ϕ(1, 4) = −4, ϕ(16, 16) = 3, and ϕ(8, 12) = 4. 输入Your program will be tested on one or more test cases. Each test case is specified on a single line. Each test case is specified using two positive integers L and U separated by one or more spaces, and satisfying the following property: 1 ≤ L ≤U <1, 000, 000 The end of the test cases is indicated by a line made of two -1’s. That last line is is not part of the test cases. 输出Description Johnny hates Number Theory! Actually, back in 2002, we came to know that Johnny couldn’t count and in 2005 we knew that Johnny couldn’t yet add. (But we did know in 2003 that Johnny was street smart enough to solve difficult graph problems!) Why Johnny decided to study Number Theory is incomprehensible to us.
The following table illustrates p(n) for the first twenty positive integers:
Given two positive integers a and b where a ≤ b, Johnny defines his very own Totient function ϕ (a, b) as follows:
For example, ϕ(1, 4) = −4, ϕ(16, 16) = 3, and ϕ(8, 12) = 4. Input Your program will be tested on one or more test cases. Each test case is specified on a single line. Each test case is specified using two positive integers L and U separated by one or more spaces, and satisfying the following property: 1 ≤ L ≤U <1, 000, 000 The end of the test cases is indicated by a line made of two -1’s. That last line is is not part of the test cases. Output For each test case, output the result on a single line using the following format: k. result Where k is the test case number (starting at 1,) and result is the maximal ϕ that can be found within the range [L,U]. Sample Input 1 5 1 20 10 20 900000 901000 -1 -1 Sample Output 1. 1 2. 7 3. 5 4. 2551 Source 样例输入1 5 1 20 10 20 900000 901000 -1 -1 样例输出1. 1 2. 7 3. 5 4. 2551 作者 |