fork(3) download
  1. N = int(input())
  2. T = input()
  3. while len(T) > 0 and T[0] == '0':
  4. T = T[1:]
  5. if T == '':
  6. T = '0'
  7. so_chu_so = len(T)
  8. V = 1
  9. for i in range(so_chu_so):
  10. V = V * 10
  11. S = N * V + int(T)
  12. a = S
  13. b = V
  14. while b > 0:
  15. a, b = b, a % b
  16. print(S // a, V // a)
Success #stdin #stdout 0.08s 14112KB
stdin
1
5
stdout
3 2