結果
| 問題 |
No.2358 xy+yz+zx=N
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-23 23:03:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,689 ms / 2,000 ms |
| コード長 | 588 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 83,072 KB |
| 最終ジャッジ日時 | 2024-07-01 17:42:57 |
| 合計ジャッジ時間 | 9,344 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
from math import sqrt
from itertools import permutations
n = int(input())
ANS = set()
th1 = n // 3
th2 = (n + 2) // 3
for x in range(n + 1):
if x**2 > th1:
break
for z in range(max(int(sqrt(th2)) - 5, x), n + 1):
res = n - x * z
if res < 0:
break
if x + z > 0 and res % (x + z) == 0:
y = res // (x + z)
if x <= y <= z:
L = [x, y, z]
for P in permutations(range(3)):
ANS.add((L[P[0]], L[P[1]], L[P[2]]))
print(len(ANS))
for x, y, z in ANS:
print(x, y, z)