Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
128125 江屹山 勾股数 Python3 Compile Error 0 MS 0 KB 411 2025-08-02 17:21:37

Tests(0/0):


Code:

import math def find_pythagorean_triplets(limit): print(f"{'a':>4} {'b':>4} {'c':>4}") for a in range(1, limit + 1): for b in range(a + 1, limit + 1): # 避免重复组合 c = int(math.sqrt(a**2 + b**2)) if c <= limit and a**2 + b**2 == c**2: print(f"{a:>4} {b:>4} {c:>4}") # 查找100以内的所有勾股数 find_pythagorean_triplets(100)


Run Info:

  File "Main.py", line 4
    print(f"{'a':>4} {'b':>4} {'c':>4}")
                                      ^
SyntaxError: invalid syntax