結果

問題 No.2358 xy+yz+zx=N
ユーザー 遭難者遭難者
提出日時 2023-04-15 12:16:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 827 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 82,532 KB
最終ジャッジ日時 2023-09-14 10:00:21
合計ジャッジ時間 3,748 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,300 KB
testcase_01 AC 75 ms
71,228 KB
testcase_02 AC 75 ms
71,232 KB
testcase_03 AC 76 ms
71,484 KB
testcase_04 AC 72 ms
71,500 KB
testcase_05 AC 78 ms
71,604 KB
testcase_06 AC 73 ms
71,400 KB
testcase_07 AC 95 ms
76,604 KB
testcase_08 AC 231 ms
82,248 KB
testcase_09 AC 237 ms
82,532 KB
testcase_10 AC 179 ms
79,200 KB
testcase_11 AC 189 ms
79,592 KB
testcase_12 AC 154 ms
78,852 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
ans.sort()
print(len(ans))
for i in ans:
    print(*i)
0