题解 | #将真分数分解为埃及分数#
将真分数分解为埃及分数
https://www.nowcoder.com/practice/e0480b2c6aa24bfba0935ffcca3ccb7b
a,b = list(map(int,input().split('/')))
a = a*10 #分子
b = b*10 #分母
res = []
# 分解a
while a :
for i in range(a,0,-1):
if b%i == 0:
res.append('1/'+str(b//i))
a -= i
break
print('+'.join(res))
查看17道真题和解析