結果

問題 No.1626 三角形の構築
ユーザー ayaoniayaoni
提出日時 2021-07-23 23:08:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 1,263 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 64,024 KB
最終ジャッジ日時 2024-04-20 16:02:30
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
54,188 KB
testcase_01 AC 46 ms
61,932 KB
testcase_02 AC 35 ms
53,808 KB
testcase_03 AC 36 ms
53,972 KB
testcase_04 AC 34 ms
52,932 KB
testcase_05 AC 34 ms
52,696 KB
testcase_06 AC 32 ms
53,208 KB
testcase_07 AC 43 ms
63,316 KB
testcase_08 AC 45 ms
61,148 KB
testcase_09 AC 47 ms
62,796 KB
testcase_10 AC 45 ms
61,296 KB
testcase_11 AC 46 ms
61,608 KB
testcase_12 AC 43 ms
61,660 KB
testcase_13 AC 42 ms
62,552 KB
testcase_14 AC 44 ms
60,904 KB
testcase_15 AC 43 ms
60,896 KB
testcase_16 AC 47 ms
63,356 KB
testcase_17 AC 45 ms
62,012 KB
testcase_18 AC 45 ms
62,272 KB
testcase_19 AC 45 ms
60,968 KB
testcase_20 AC 45 ms
62,272 KB
testcase_21 AC 46 ms
63,248 KB
testcase_22 AC 45 ms
61,588 KB
testcase_23 AC 51 ms
63,680 KB
testcase_24 AC 47 ms
64,024 KB
testcase_25 AC 35 ms
53,272 KB
testcase_26 AC 44 ms
60,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import floor,sqrt
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


t = I()
for _ in range(t):
    S,T = MI()
    U = 2*S**2
    if U % T != 0 or T % 2 == 1:
        print(0)
        continue
    ANS = set()
    U //= T
    for d in range(1,int(U**(1/3))+1):
        if U % d == 0:
            c = T//2-d
            if c <= 0 or c > 10**9:
                break
            V = U//d
            p = T//2+d
            q = V+T//2*d
            if p**2-4*q < 0:
                continue
            a = floor((p-sqrt(p**2-4*q))//2)
            if 0 < a <= 10**9:
                b = p-a
                if 0 < b <= 10**9:
                    if a*b == q:
                        ans = [a,b,c]
                        ans.sort()
                        ANS.add(tuple(ans))
    print(len(ANS))
    for ans in ANS:
        a,b,c = ans
        print(a,b,c)
0