3689.Nearest Fraction

Time Limit: 1s Memory Limit: 256MB

You are given three positive integers x,y,n. Your task is to find the nearest fraction to fraction 3689_1.png whose denominator is no more than n. Formally, you should find such pair of integers a,b (1 \le b \le n;0 \le a) that the value 3689_2.png is as minimal as possible.If there are multiple "nearest" fractions, choose the one with the minimum denominator. If there are multiple "nearest" fractions with the minimum denominator, choose the one with the minimum numerator.

Input Format(From the terminal/stdin)

Input A single line contains three integers x,y,n (1 \le x,y,n \le 105).

Output Format(To the terminal/stdout)

Output Print the required fraction in the format "a/b" (without quotes).

Sample Input 1

Copy
3 7 6
 · · \n

Sample Output 1

Copy
2/5
   \n

Sample Input 2

Copy
7 2 4
 · · \n

Sample Output 2

Copy
7/2
   \n

Submit

请先 登录

© 2025 FAQs