結果

問題 No.2358 xy+yz+zx=N
ユーザー chankei271828chankei271828
提出日時 2023-06-24 00:15:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,709 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 84,640 KB
最終ジャッジ日時 2023-09-14 10:16:58
合計ジャッジ時間 10,157 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,364 KB
testcase_01 AC 72 ms
71,436 KB
testcase_02 AC 73 ms
71,392 KB
testcase_03 AC 74 ms
71,516 KB
testcase_04 AC 73 ms
71,372 KB
testcase_05 AC 71 ms
71,328 KB
testcase_06 AC 77 ms
76,248 KB
testcase_07 AC 103 ms
77,472 KB
testcase_08 AC 1,709 ms
84,576 KB
testcase_09 AC 1,707 ms
84,640 KB
testcase_10 AC 1,691 ms
80,948 KB
testcase_11 AC 1,690 ms
81,704 KB
testcase_12 AC 1,317 ms
79,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
#xy+yz+zx=N
#x<=y<=zで探索
ans=set()
for x in range(N+1):
    if 3*x**2>N:
        break
    for y in range(x,N+1):
        if x==0 and y==0:
            continue
        if x*y>N:
            break
        if (N-(x*y))%(x+y)==0:
            z=(N-(x*y))//(x+y)
            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 tup in ans:
    print(*tup)
0