详细分析见精准表达浮点数 (python)
import math p, q = map(int,input().split()) a = input() b = a[p-1:q] a, b = int(a), int(b) subnums, momnums = (10**(q-p+1)-1)*a + b, (10**q)*(10**(q-p+1)-1) print(int(subnums/math.gcd(subnums,momnums)), int(momnums/(math.gcd(subnums,momnums))))



