結果
問題 | No.1626 三角形の構築 |
ユーザー |
![]() |
提出日時 | 2024-02-04 16:30:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,449 bytes |
コンパイル時間 | 345 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 66,432 KB |
最終ジャッジ日時 | 2024-09-28 11:19:30 |
合計ジャッジ時間 | 3,205 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 WA * 1 |
ソースコード
import sys # sys.setrecursionlimit(1000005) # sys.set_int_max_str_digits(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = -1-(-1 << 31) inf = -1-(-1 << 62) # md = 10**9+7 md = 998244353 # 16s2/t=(t-2a)(t-2b)(t-2c) # 16s2/t=xyz # a+(t-y)/2+(t-z)/2=t # 2a+t-y+t-z=2t # 2a+t-y+t-z=2t # y+z=2a # y2-2ay+v=0 # y=a-sqrt(a2-v) from math import isqrt def solve(): s, t = LI() s = s*s*16 if s%t: print(0) return s //= t ans = [] for x in range(2-(t & 1), t-1, 2): if x**3 > s: break if s%x:continue a=(t-x)//2 v=s//x if a*a-v<0:continue r=isqrt(a*a-v) if r*r!=a*a-v:continue y=a-r if y<x:break z=2*a-y b,c=(t-y)//2,(t-z)//2 if a<b+c:ans.append((a,b,c)) print(len(ans)) for a,b,c in ans:print(a,b,c) for _ in range(II()): solve()