結果

問題 No.2358 xy+yz+zx=N
ユーザー nikoro256nikoro256
提出日時 2023-06-23 22:34:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 517 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 88,444 KB
最終ジャッジ日時 2023-09-14 10:13:47
合計ジャッジ時間 4,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,460 KB
testcase_01 AC 70 ms
71,548 KB
testcase_02 AC 71 ms
71,552 KB
testcase_03 AC 73 ms
71,552 KB
testcase_04 AC 70 ms
71,408 KB
testcase_05 AC 70 ms
71,204 KB
testcase_06 AC 77 ms
76,140 KB
testcase_07 AC 99 ms
77,172 KB
testcase_08 AC 517 ms
87,504 KB
testcase_09 AC 513 ms
88,444 KB
testcase_10 AC 488 ms
81,524 KB
testcase_11 AC 495 ms
82,516 KB
testcase_12 AC 399 ms
79,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N=int(input())
lis=[]
for x in range(math.ceil(math.sqrt(N))+1):
    for y in range(x,math.ceil(math.sqrt(N))+1):
        if x==0 and y==0:
            continue
        #print(x,y)
        z=-1
        if (N-x*y)>0 and (N-x*y)/(x+y)%1==0:
            z=(N-x*y)//(x+y)
        elif N-x*y==0:
            z=0
        if z!=-1:
            lis.append((x,y,z))
            lis.append((x,z,y))
            lis.append((y,x,z))
            lis.append((y,z,x))
            lis.append((z,x,y))
            lis.append((z,y,x))
lis=set(lis)
print(len(lis))
for l in lis:
    print(*l)
0