Home STD Contest Notification Clarification Problems Ranklist Status Print Sign Out

Rational and Irrational

Time 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
2 5 3 10 5 100 0 0
 

Sample Output
3/2 7/4 85/38
 

Author
iSea@WHU
 

Statistic | Submit | Clarifications | Back