結果
問題 | No.2358 xy+yz+zx=N |
ユーザー | meruuu61779999 |
提出日時 | 2023-06-24 00:25:41 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 10,980 KB |
実行使用メモリ | 13,224 KB |
最終ジャッジ日時 | 2023-09-14 10:17:33 |
合計ジャッジ時間 | 11,760 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,260 KB |
testcase_01 | AC | 17 ms
8,416 KB |
testcase_02 | AC | 17 ms
8,396 KB |
testcase_03 | AC | 16 ms
8,192 KB |
testcase_04 | AC | 17 ms
8,268 KB |
testcase_05 | AC | 16 ms
8,348 KB |
testcase_06 | AC | 18 ms
8,344 KB |
testcase_07 | AC | 26 ms
8,628 KB |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | AC | 1,669 ms
9,472 KB |
ソースコード
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)