結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2023-06-23 22:34:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 353 ms / 2,000 ms |
コード長 | 828 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 95,616 KB |
最終ジャッジ日時 | 2024-07-01 17:39:42 |
合計ジャッジ時間 | 3,149 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
from collections import *from functools import *from itertools import *from heapq import *import sys,mathinput = sys.stdin.readlineN = int(input())def f(M):tmp = []n = 1while n**2 < M:if M%n==0:tmp.append(n)tmp.append(M//n)n += 1if n**2==M:tmp.append(n)return tmpdef g(M,S):X = []for s in f(M+S**2):if s-S<0:continuet = (M+S**2)//sif t-S<0:continueX.append((s-S,t-S))return Xans = []M = math.ceil(math.sqrt(N)+1)for i in range(M+1):if i**2>N:breakfor x,y in g(N,i):tmp = [i,x,y]for p in permutations(tmp):ans.append(tuple(p))ans = set(ans)print(len(ans))for a in ans:print(*a)