結果

問題 No.2358 xy+yz+zx=N
ユーザー shogo314shogo314
提出日時 2023-06-23 23:15:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 974 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 77,800 KB
最終ジャッジ日時 2023-09-14 10:15:57
合計ジャッジ時間 5,030 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,044 KB
testcase_01 AC 74 ms
71,360 KB
testcase_02 AC 74 ms
71,268 KB
testcase_03 AC 75 ms
71,348 KB
testcase_04 AC 74 ms
71,460 KB
testcase_05 AC 75 ms
71,232 KB
testcase_06 AC 87 ms
76,508 KB
testcase_07 AC 114 ms
77,800 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
ans = []
for x in range(N+1):
    if 3*x*x > N:
        break
    for y in range(x, N+1):
        if x*y+y*y+y*x > N:
            break
        for z in range(y, N+1):
            if x*y+y*z+z*x > N:
                break
            if x*y+y*z+z*x == N:
                if x == y == z:
                    ans.append((x, y, z))
                elif x == y:
                    ans.append((x, y, z))
                    ans.append((x, z, y))
                    ans.append((z, x, y))
                elif y == z:
                    ans.append((x, y, z))
                    ans.append((y, x, z))
                    ans.append((y, z, x))
                else:
                    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))
print(len(ans))
for a in ans:
    print(*a)
0