結果

問題 No.2358 xy+yz+zx=N
ユーザー 遭難者遭難者
提出日時 2023-06-05 14:41:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 83,380 KB
最終ジャッジ日時 2023-09-14 10:01:27
合計ジャッジ時間 2,920 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,340 KB
testcase_01 AC 74 ms
71,596 KB
testcase_02 AC 75 ms
71,312 KB
testcase_03 AC 75 ms
71,304 KB
testcase_04 AC 75 ms
71,296 KB
testcase_05 AC 76 ms
71,472 KB
testcase_06 AC 77 ms
71,116 KB
testcase_07 AC 98 ms
76,832 KB
testcase_08 AC 176 ms
82,460 KB
testcase_09 AC 181 ms
83,380 KB
testcase_10 AC 164 ms
78,944 KB
testcase_11 AC 166 ms
79,452 KB
testcase_12 AC 146 ms
78,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
nn = n // 3
ans = []
x, xx = 0, 0
while xx <= nn:
    k = n + xx
    yy = x << 1
    yyy = yy * yy
    while yyy <= k:
        if yy == 0 or k % yy > 0:
            yyy += (yy << 1) | 1
            yy += 1
            continue
        y, z = yy - x, k // yy - x
        if x != y and y != z:
            ans.append([x, y, z])
            ans.append([x, z, y])
            ans.append([y, x, z])
            ans.append([y, z, x])
            ans.append([z, x, y])
            ans.append([z, y, x])
        elif x != y or y != z:
            ans.append([x, y, z])
            ans.append([y, z, x])
            ans.append([z, x, y])
        else:
            ans.append([x, y, z])
        yyy += (yy << 1) | 1
        yy += 1
    xx += (x << 1) | 1
    x += 1
print(len(ans))
for i in ans:
    print(*i)
0