結果

問題 No.2358 xy+yz+zx=N
ユーザー ntudantuda
提出日時 2023-06-26 23:05:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 83,988 KB
最終ジャッジ日時 2023-09-16 18:32:00
合計ジャッジ時間 4,756 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,400 KB
testcase_01 AC 74 ms
71,396 KB
testcase_02 AC 78 ms
71,396 KB
testcase_03 WA -
testcase_04 AC 72 ms
71,588 KB
testcase_05 WA -
testcase_06 AC 74 ms
71,312 KB
testcase_07 WA -
testcase_08 AC 177 ms
83,268 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 145 ms
78,216 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:
                tmp.append((x, x, x))
            elif x == y or y == z:
                tmp.append((x, x, z))
                tmp.append((x, z, x))
                tmp.append((z, x, 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