結果

問題 No.2358 xy+yz+zx=N
ユーザー やでな@競プロやでな@競プロ
提出日時 2023-10-09 15:03:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 90,304 KB
最終ジャッジ日時 2023-10-09 15:03:16
合計ジャッジ時間 3,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,500 KB
testcase_01 AC 73 ms
71,776 KB
testcase_02 AC 73 ms
71,936 KB
testcase_03 AC 73 ms
71,612 KB
testcase_04 AC 72 ms
72,008 KB
testcase_05 AC 72 ms
71,700 KB
testcase_06 AC 81 ms
76,464 KB
testcase_07 AC 111 ms
78,412 KB
testcase_08 AC 269 ms
90,236 KB
testcase_09 AC 269 ms
90,304 KB
testcase_10 AC 233 ms
82,680 KB
testcase_11 AC 240 ms
84,336 KB
testcase_12 AC 198 ms
79,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

ans = 0
lis = []
used = set()

for x in range(int(n**(0.5))+2):
    for y in range(x,int(n**(0.5))+2):
        ue = n-x*y
        if ue >= 0:
            if x == y == 0:
                continue
            if (n-x*y)%(x+y) == 0:
                z = (n-(x*y))//(x+y)
                if x <= y <= z and x*y+y*z+x*z == n:
                    tmp = [x,y,z]
                    for i in tmp:
                        for j in tmp:
                            for k in tmp:
                                if (i,j,k) not in used and i*j+j*k+i*k == n:
                                    ans += 1
                                    used.add((i,j,k))
                                    lis.append([i,j,k])
print(ans)
for li in lis:
    print(*li)
0