結果

問題 No.2358 xy+yz+zx=N
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-06-23 22:54:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 83,124 KB
最終ジャッジ日時 2023-09-14 10:14:31
合計ジャッジ時間 4,587 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,260 KB
testcase_01 AC 73 ms
71,276 KB
testcase_02 AC 75 ms
71,308 KB
testcase_03 WA -
testcase_04 AC 74 ms
71,304 KB
testcase_05 WA -
testcase_06 AC 84 ms
76,556 KB
testcase_07 WA -
testcase_08 AC 387 ms
82,240 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 309 ms
78,288 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