結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2024-08-11 16:27:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,387 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 84,352 KB |
最終ジャッジ日時 | 2024-08-11 16:27:43 |
合計ジャッジ時間 | 3,619 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 7 |
ソースコード
# cook your dish herefrom collections import defaultdict,dequefrom bisect import bisect_left,bisect_rightfrom itertools import accumulate,permutations,groupbyimport sysfrom math import gcd,isqrtimport heapqimport mathimport string#from sortedcontainers import SortedSet, SortedList, SortedDict#import pulpimport random#from more_itertools import*#from functools import cache#import pypyjit#pypyjit.set_param('max_unroll_recursion=-1')#sys.setrecursionlimit(10**6)#input=lambda :sys.stdin.readline()[:-1]class ready():def getint(self):return int(input())def getflo(self):return float(input())def getmanyint(self):return map(int,input().split())def gettree(self,n):g=[[] for _ in range(n)]for _ in range(n-1):u,v,c=map(int,input().split())g[u-1].append([v-1,c])g[v-1].append([u-1,c])return gR=ready()#ここからコ―ドn=int(input())#z固定したらz^2<=n/3になったな。#なのでz^2<=n//3<=>z<=isqrt(z//3)です。ans=[]supz=isqrt(n//3)supy=isqrt(n)for z in range(supz+1):for y in range(z,supy+1):if z==y==0:continueif (n-z*y)%(z+y)==0:temp=list(set(permutations([z,y,(n-z*y)//(y+z)])))for k in temp:ans.append(k)print(len(ans))for a in ans:print(*a)