結果
問題 | No.2358 xy+yz+zx=N |
ユーザー | mkawa2 |
提出日時 | 2023-06-23 21:31:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,898 ms / 2,000 ms |
コード長 | 1,152 bytes |
コンパイル時間 | 295 ms |
コンパイル使用メモリ | 87,124 KB |
実行使用メモリ | 84,504 KB |
最終ジャッジ日時 | 2023-09-14 10:02:42 |
合計ジャッジ時間 | 11,162 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,096 KB |
testcase_01 | AC | 72 ms
71,260 KB |
testcase_02 | AC | 76 ms
71,380 KB |
testcase_03 | AC | 74 ms
71,352 KB |
testcase_04 | AC | 74 ms
71,172 KB |
testcase_05 | AC | 73 ms
71,172 KB |
testcase_06 | AC | 83 ms
76,600 KB |
testcase_07 | AC | 107 ms
77,536 KB |
testcase_08 | AC | 1,886 ms
84,484 KB |
testcase_09 | AC | 1,898 ms
84,504 KB |
testcase_10 | AC | 1,864 ms
80,268 KB |
testcase_11 | AC | 1,881 ms
81,408 KB |
testcase_12 | AC | 1,464 ms
78,912 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) # sys.set_int_max_str_digits(1000005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 md = 10**9+7 # md = 998244353 # xy+yz+zx=n # z=(n-xy)/(y+x) n=II() ans=set() for x in range(n+1): for y in range(x,n+1): if n-x*y<0:break if x+y==0:continue if (n-x*y)%(x+y):continue z=(n-x*y)//(x+y) ans.add((x,y,z)) ans.add((y,x,z)) ans.add((z,y,x)) ans.add((x,z,y)) ans.add((y,z,x)) ans.add((z,x,y)) print(len(ans)) for x,y,z in ans:print(x,y,z)