
详细分析见精准表达浮点数 (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))))
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)