結果

問題 No.2358 xy+yz+zx=N
ユーザー komkompikomkompi
提出日時 2023-07-15 06:28:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,062 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 84,140 KB
最終ジャッジ日時 2023-10-14 21:04:53
合計ジャッジ時間 13,887 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 791 ms
77,140 KB
testcase_01 AC 789 ms
77,220 KB
testcase_02 AC 792 ms
77,412 KB
testcase_03 AC 791 ms
77,100 KB
testcase_04 AC 797 ms
77,132 KB
testcase_05 AC 793 ms
77,060 KB
testcase_06 AC 830 ms
77,300 KB
testcase_07 AC 850 ms
77,816 KB
testcase_08 AC 1,049 ms
83,664 KB
testcase_09 AC 1,062 ms
84,140 KB
testcase_10 AC 1,018 ms
80,252 KB
testcase_11 AC 1,022 ms
80,988 KB
testcase_12 AC 987 ms
78,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())

#xy+yz+zx=(N-x**2-y**2-z**2)/2
ITER=3400

ans=set()
for x in range(ITER):
    for y in range(ITER):
        if x+y==0:
            continue

        z=(N-x*y)/(x+y)
        if z==z//1 and z>=0:
            z=int(z)
            ans.add((x,y,z))
            ans.add((x,z,y))
            ans.add((y,x,z))
            ans.add((y,z,x))
            ans.add((z,x,y))
            ans.add((z,y,x))
            
print(len(ans))

for item in ans:
    print(*item)
0