結果

問題 No.2358 xy+yz+zx=N
ユーザー ntudantuda
提出日時 2023-06-26 23:13:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 959 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 83,928 KB
最終ジャッジ日時 2023-09-16 18:42:36
合計ジャッジ時間 3,104 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,344 KB
testcase_01 AC 73 ms
71,332 KB
testcase_02 AC 73 ms
71,452 KB
testcase_03 AC 72 ms
71,288 KB
testcase_04 AC 73 ms
71,616 KB
testcase_05 AC 74 ms
71,464 KB
testcase_06 AC 75 ms
71,672 KB
testcase_07 AC 92 ms
76,708 KB
testcase_08 AC 175 ms
83,116 KB
testcase_09 AC 177 ms
83,928 KB
testcase_10 AC 159 ms
79,088 KB
testcase_11 AC 164 ms
79,840 KB
testcase_12 AC 146 ms
78,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = 0
tmp = []
while 3 * x * x <= N:
    y = x
    if x == 0:
        y = 1
    while y * (2 * x + y) <= N:
        if (N - x * y) % (x + y) == 0:
            z = (N - x * y) // (x + y)
            if x <= y <= z:
                if x == y == z:
                    tmp.append((x, x, x))
                elif x == y:
                    tmp.append((x, x, z))
                    tmp.append((x, z, x))
                    tmp.append((z, x, x))
                elif y == z:
                    tmp.append((x, z, z))
                    tmp.append((z, x, z))
                    tmp.append((z, z, x))
                else:
                    tmp.append((x, y, z))
                    tmp.append((x, z, y))
                    tmp.append((y, x, z))
                    tmp.append((y, z, x))
                    tmp.append((z, x, y))
                    tmp.append((z, y, x))
        y += 1
    x += 1
print(len(tmp))
for t in tmp:
    print(*t)
0