結果

問題 No.2358 xy+yz+zx=N
ユーザー ShirotsumeShirotsume
提出日時 2023-06-23 22:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,763 ms / 2,000 ms
コード長 779 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 102,920 KB
最終ジャッジ日時 2023-09-14 10:15:23
合計ジャッジ時間 10,788 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
74,756 KB
testcase_01 AC 121 ms
74,672 KB
testcase_02 AC 115 ms
74,632 KB
testcase_03 AC 114 ms
74,756 KB
testcase_04 AC 116 ms
74,404 KB
testcase_05 AC 114 ms
74,464 KB
testcase_06 AC 125 ms
79,376 KB
testcase_07 AC 161 ms
82,172 KB
testcase_08 AC 1,763 ms
100,252 KB
testcase_09 AC 1,757 ms
102,920 KB
testcase_10 AC 1,656 ms
88,688 KB
testcase_11 AC 1,706 ms
90,788 KB
testcase_12 AC 1,338 ms
85,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import itertools

n = ii()
ans = []
for x in range(1, n + 1):
    if x * x > n:
        break
    if 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:
        break
    for 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)
0