| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 85276 | 张祁清 | 百钱买百鸡II | Python3 | Compile Error | 0 MS | 0 KB | 579 | 2024-07-16 20:52:29 |
def buy_chickens(N): solutions = [] for x in range(N // 5 + 1): # 公鸡数量不能超过总金额除以5 for y in range(N // 3 + 1): # 母鸡数量不能超过总金额除以3 z = N - x - y # 小鸡数量 if 5 * x + 3 * y + (1/3) * z == N: # 检查总价是否等于N solutions.append((x, y, z)) return solutions def print_solutions(solutions): if not solutions: print("None") else: for i, (x, y, z) in enumerate(solutions, start=1): print(f"{i}: {x}, {y}, {z}")
File "Main.py", line 15
print(f"{i}: {x}, {y}, {z}")
^
SyntaxError: invalid syntax