| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 72814 | 胡海峰老师 | 拆分分数 | Python3 | Accepted | 39 MS | 3796 KB | 603 | 2024-05-12 18:43:54 |
#1490 def split_fraction(k): results = [] for x in range(k + 1, 2 * k+1): if k * x % (x - k) == 0: # 确保y是整数 y = k * x // (x-k) if x <= y: # 确保x <= y results.append((x, y)) return results def print_fractions(k): for x, y in split_fraction(k): print("1/{} = 1/{} + 1/{}".format(k,x,y)) # 1 / 5 = 1 / 6 + 1 / 30 # 1 / 5 = 1 / 10 + 1 / 10 # 输入 k = int(input()) # 输出 print_fractions(k) """ 1/5 = 1/6 + 1/30 1/5 = 1/10 + 1/10 1/5 = 1/6 + 1/30 1/5 = 1/10 + 1/10 """