Rational and IrrationalTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 255 Accepted Submission(s): 74
Problem Description Find the minimal rational A/B which is bigger than (or equal to) a irrational ¡ÌP. The rational should be irreducible, that is, the greatest common divisor of A and B should be 1. What¡¯s more, both A and B should be smaller than (or equal to) a given N, you can assume that N is always bigger than ¡ÌP.
Input The input file consists of a number of test cases. Each case consists of two positive integers P and N (P, N <= 1000) on a single line. The input ends with a line containing two 0¡¯s.
Output For each input line, print a rational numbers A/B, as description said.
Sample Input
Sample Output
Author Statistic | Submit | Clarifications | Back
|