結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2023-07-07 12:24:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 195 ms / 2,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 81,920 KB |
最終ジャッジ日時 | 2024-07-21 07:27:31 |
合計ジャッジ時間 | 2,950 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
from itertools import permutationsdef make_divisors_pairs(n): #約数のペアを作る O(sqrt(n))divisors = []i = 1while i*i <= n:if n % i == 0:divisors.append([i,n//i])i += 1return divisorsN = int(input())ans = set()for x in range(int((N/3)**(1/2))+10):for p, q in make_divisors_pairs(N+x*x):if p-x >= 0 and q-x >= 0:for per in permutations((x, p-x, q-x)):ans.add(per)print(len(ans))for a in ans:print(*a)