結果
問題 |
No.2358 xy+yz+zx=N
|
ユーザー |
![]() |
提出日時 | 2023-06-24 00:25:41 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 15,716 KB |
最終ジャッジ日時 | 2024-07-01 17:44:34 |
合計ジャッジ時間 | 13,746 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 TLE * 5 |
ソースコード
import math from itertools import permutations N = int(input()) max_x = math.isqrt(N // 3) max_y = math.isqrt(N) ans_set = set() # ans_set にタプル(x,y,z)の並び替え6通りを登録する関数 def register(t: tuple): for p in permutations(range(3)): ans_set.add((t[p[0]], t[p[1]], t[p[2]])) for x in range(max_x + 1): for y in range(x, max_y + 1): if x == y == 0: continue z, mod = divmod(N - x * y, x + y) if mod == 0: register((x, y, z)) print(len(ans_set)) for ans in ans_set: print(*ans)