Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
76944 胡海峰老师 拆分分数 Python3 Accepted 41 MS 3792 KB 344 2024-06-06 12:06:06

Tests(20/20):


Code:

def split_fraction(k): solutions = [] for x in range(k+1, 2*k + 1): y = k * x // (x - k) if k * x %(x - k) ==0: solutions.append((x, y)) #1/k = 1/x + 1/y (x-k)y = xk return solutions k = int(input()) res = split_fraction(k) for x,y in res: print("1/{} = 1/{} + 1/{}".format(k, x, y))