結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2023-06-23 22:57:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,714 ms / 2,000 ms |
コード長 | 779 bytes |
コンパイル時間 | 333 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 96,896 KB |
最終ジャッジ日時 | 2024-07-01 17:42:35 |
合計ジャッジ時間 | 9,785 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
import sys, time, randomfrom collections import deque, Counter, defaultdictinput = lambda: sys.stdin.readline().rstrip()ii = lambda: int(input())mi = lambda: map(int, input().split())li = lambda: list(mi())inf = 2 ** 63 - 1mod = 998244353import itertoolsn = ii()ans = []for x in range(1, n + 1):if x * x > n:breakif n % x == 0:for v in itertools.permutations([0, n // x, x]):ans.append(tuple(v))for x in range(1, n + 1):if x * x > n:breakfor y in range(1, n // x + 1):if (n - x * y) % (x + y) == 0:z = (n - x * y) // (x + y)for v in itertools.permutations([x, y, z]):ans.append(tuple(v))ans = list(set(ans))print(len(ans))for v in ans:print(*v)