Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73319 屠佳毅 完美立方 Python3 Accepted 1448 MS 3796 KB 393 2024-05-18 17:04:24

Tests(10/10):


Code:

N = int(input()) result = [] for a in range(2, N + 1): a_cube = a ** 3 for b in range(2, a + 1): for c in range(b, a + 1): for d in range(c, a + 1): if a_cube == b*b*b + c * c * c + d*d*d: result.append((a, b, c, d)) result.sort() for a, b, c, d in result: print("Cube = {}, Triple = ({},{},{})".format(a,b,c,d))