結果

問題 No.2358 xy+yz+zx=N
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-06-23 22:55:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 82,552 KB
最終ジャッジ日時 2023-09-14 10:14:46
合計ジャッジ時間 4,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,180 KB
testcase_01 AC 70 ms
71,536 KB
testcase_02 AC 75 ms
71,228 KB
testcase_03 WA -
testcase_04 AC 72 ms
71,304 KB
testcase_05 AC 71 ms
71,256 KB
testcase_06 AC 78 ms
76,476 KB
testcase_07 AC 98 ms
76,836 KB
testcase_08 AC 382 ms
82,200 KB
testcase_09 AC 387 ms
82,552 KB
testcase_10 AC 364 ms
78,788 KB
testcase_11 AC 368 ms
79,712 KB
testcase_12 AC 306 ms
78,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

ans = []


### x < y < z
for x in range(N):
    for y in range(x+1,N+1):
        if 2*x*y + y*y > N:
            break

        n = N - x*y
        if n%(x+y):
            continue
        z = n // (x+y)
        if z <= y:
            continue
        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])


### x = y ,z

for x in range(1,N):
    
    n = N - x**2

    if n < 0 or n%(x+x):
        continue

    z = n // (x+x)

    if z == x:
        ans.append([x,x,x])
    else:
        ans.append([x,x,z])
        ans.append([x,z,x])
        ans.append([z,x,x])


print(len(ans))
for x,y,z in ans:
    print(x,y,z)
0