| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 72808 | 胡海峰老师 | 拆分分数 | Python3 | Wrong Answer | 31 MS | 3776 KB | 523 | 2024-05-12 18:42:47 |
#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)
------Input------
4
------Answer-----
1/4 = 1/5 + 1/20 1/4 = 1/6 + 1/12 1/4 = 1/8 + 1/8
------Your output-----
1 / 4 = 1 / 5 + 1 / 20 1 / 4 = 1 / 6 + 1 / 12 1 / 4 = 1 / 8 + 1 / 8