結果

問題 No.2358 xy+yz+zx=N
ユーザー flygonflygon
提出日時 2023-06-23 22:08:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 88,352 KB
最終ジャッジ日時 2023-09-14 10:08:58
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
72,084 KB
testcase_01 AC 99 ms
71,996 KB
testcase_02 AC 103 ms
71,832 KB
testcase_03 AC 101 ms
71,724 KB
testcase_04 AC 102 ms
72,012 KB
testcase_05 AC 101 ms
71,892 KB
testcase_06 AC 107 ms
77,268 KB
testcase_07 AC 126 ms
78,200 KB
testcase_08 AC 250 ms
87,168 KB
testcase_09 AC 251 ms
88,352 KB
testcase_10 AC 230 ms
81,776 KB
testcase_11 AC 231 ms
83,044 KB
testcase_12 AC 204 ms
80,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
sq = int(n**0.5)+5
ans = set()
for x in range(sq):
    for y in range(x, sq):
        if x + y == 0: continue
        left = n-x*y
        if left < 0:break
        if left % (x+y) == 0:
            z = left//(x+y)
            if z <y :break
            ans.add((x,y,z))
            ans.add((x,z,y))
            ans.add((y,x,z))
            ans.add((y,z,x))
            ans.add((z,x,y))
            ans.add((z,y,x))

print(len(ans))
for i in ans:
    print(*i)
0