結果

問題 No.2358 xy+yz+zx=N
ユーザー 👑 rin204rin204
提出日時 2024-04-14 21:15:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 85,460 KB
最終ジャッジ日時 2024-04-14 21:15:22
合計ジャッジ時間 2,691 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,000 KB
testcase_01 AC 43 ms
52,956 KB
testcase_02 AC 41 ms
52,472 KB
testcase_03 AC 39 ms
52,684 KB
testcase_04 AC 39 ms
52,212 KB
testcase_05 AC 42 ms
52,592 KB
testcase_06 AC 42 ms
52,916 KB
testcase_07 AC 80 ms
69,528 KB
testcase_08 AC 214 ms
84,776 KB
testcase_09 AC 217 ms
85,460 KB
testcase_10 AC 156 ms
79,924 KB
testcase_11 AC 191 ms
81,140 KB
testcase_12 AC 143 ms
77,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ans = set()

for x in range(n + 1):
    if 3 * x * x > n:
        break
    for y in range(max(x, 1), n + 1):
        if x * y + x * y + y * y > n:
            break
        if (n - x * y) % (x + y) == 0:
            z = (n - x * y) // (x + y)
            ans.add((x, y, z))
            ans.add((x, z, y))
            ans.add((y, x, z))
            ans.add((y, z, x))
            ans.add((z, x, y))
            ans.add((z, y, x))

print(len(ans))
for x, y, z in sorted(ans):
    print(x, y, z)
0