Problem Author: | Aritro Sarkar |
textbfPrepared by: | Hasan Saleh (MathModel) |
textbfEdited by: | Hasan Saleh (MathModel) |
Solution
The solution can be claimed by observing the pattern for (a,b,k \le 50) or similar bounds , we can verify that the answer is exactly \displaystyle \frac{a}{b} and actually doesn't matter.
Proof :
By Algebraic Representation : Since and both have digits, repeating a number for times can be expressed as a geometric series. Specifically:
thus
thus we divide both by their greatest common divisor to get the irreducible fraction.
Complexity O(t \cdot \log(10^{15}) which is at most operations under the current constraints.
from math import gcd
def solve():
a,b,k=map(int,input().split())
print(a//gcd(a,b),b//gcd(a,b))
for _ in range(int(input())):
solve()