結果

問題 No.2358 xy+yz+zx=N
ユーザー Nikkuniku029Nikkuniku029
提出日時 2023-06-24 11:09:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 85,716 KB
最終ジャッジ日時 2023-09-14 10:18:17
合計ジャッジ時間 3,669 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,152 KB
testcase_01 AC 76 ms
71,256 KB
testcase_02 AC 77 ms
71,484 KB
testcase_03 AC 75 ms
71,376 KB
testcase_04 AC 77 ms
71,028 KB
testcase_05 AC 75 ms
71,412 KB
testcase_06 AC 84 ms
76,128 KB
testcase_07 AC 104 ms
77,176 KB
testcase_08 AC 338 ms
84,752 KB
testcase_09 AC 335 ms
85,716 KB
testcase_10 AC 299 ms
80,740 KB
testcase_11 AC 307 ms
81,976 KB
testcase_12 AC 251 ms
78,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = set()
for x in range(N+1):
    if x**2 > N:
        break
    for y in range(N+1):
        if y**2 > N:
            break
        if x == 0 and y == 0:
            continue
        if (N-x*y) % (x+y) == 0:
            z = (N-x*y)//(x+y)
            if z >= 0:
                S.add((x, y, z))
                S.add((x, z, y))
                S.add((y, x, z))
                S.add((y, z, x))
                S.add((z, y, x))
                S.add((z, x, y))


print(len(S))
for c in S:
    print(*c)
0