結果

問題 No.2358 xy+yz+zx=N
ユーザー miya145592miya145592
提出日時 2023-06-23 23:24:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 86,164 KB
最終ジャッジ日時 2023-09-14 10:16:14
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,476 KB
testcase_01 AC 75 ms
71,636 KB
testcase_02 AC 75 ms
71,216 KB
testcase_03 AC 75 ms
71,636 KB
testcase_04 AC 75 ms
71,336 KB
testcase_05 AC 77 ms
71,296 KB
testcase_06 AC 77 ms
71,216 KB
testcase_07 AC 100 ms
77,012 KB
testcase_08 AC 235 ms
85,488 KB
testcase_09 AC 239 ms
86,164 KB
testcase_10 AC 216 ms
80,976 KB
testcase_11 AC 218 ms
82,012 KB
testcase_12 AC 189 ms
79,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N = int(input())

S = set()
for x in range(int(math.sqrt(N))+1):
    for y in range(max(1, x), int(math.sqrt(N))+1):
        if (N-x*y)%(y+x)==0:
            z = (N-x*y)//(y+x)
            S.add((x, y, z))
#print(S)

ans = set()
for x, y, z in S:
    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 a in ans:
    print(*a)
0