АВТ
Language: Russian
English

Remote Training on Programming

Problems Online status Contests
News FAQ E-learning
For authors:
Register  ||  Login
 
Hello, Guest! Please login or register.

36. Closest fraction

Time Limit: 1 seconds
Memory Limit:65536KB
Points:100
View Problem Statistics Submit Problem added debug

Дана рациональная дробь вида a/b, где a и b - натуральные числа, и натуральное q ≤ b. Найти дробь вида a1/b1 со знаменатем b1 ≤ q, представляющую исходную дробь наиболее точно.

Input

Три натуральных числа a, b и q, разделённые пробелами. Числа не превосходят 100000, q ≤ b.

Output

Два числа a1 и b1 - числитель и знаменатель найденной дроби.

Sample

InputOutput
105 38 2558 21

View Problem Statistics Submit Problem discussion Author/source:
Sorted Problems / Mathematics / Theory of numbers /
1631. A-B 36. 35. Continued fraction 470. Divide into pairs 41. Divisibility
Problems from Contests and Camps / School olympiads and couses of Vologda region / Impulse - 2019 / Number Theory /
179. 02 - Great Triangle Area 36. 1650. 04 - Divisors-2 1630. 05 - Fractional Arithmetics 482. 06 - Multiple with equal digits
Problems from Contests and Camps / School olympiads and couses of Vologda region / Impulse, september 2020 / Impulse-2020, number theory /
179. 02 - Great Triangle Area 36. 1650. 04 - Divisors-2 1630. 05 - Fractional Arithmetics 482. 06 - Multiple with equal digits
time generating 0.437 sec.
© Copyright VSU, AVT, Nosov D.A., Andrianov I.A.