题解 | 将真分数分解为埃及分数
## 分解原理参考https://blog.nowcoder.net/n/8ab21466ce9a4a18b289d31a50b8cb7b?f=comment
## 使用原理中的公式可快速解答本题。谢谢大佬。
while True:
try:
a, b = list(map(int, input().split("/")))
res = []
while b % a != 0:
c = 1 + b // a
res.append("1/{}".format(c))
a = a - b % a
b = b * c
res.append("1/{}".format(b // a))
print("+".join(res))
except:
break


查看19道真题和解析