結果

問題 No.1626 三角形の構築
ユーザー tamatotamato
提出日時 2021-07-23 23:02:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 971 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 82,644 KB
最終ジャッジ日時 2024-04-20 16:01:11
合計ジャッジ時間 29,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
67,196 KB
testcase_01 AC 1,379 ms
76,032 KB
testcase_02 AC 33 ms
52,900 KB
testcase_03 AC 33 ms
52,472 KB
testcase_04 AC 33 ms
52,536 KB
testcase_05 AC 34 ms
52,888 KB
testcase_06 AC 35 ms
53,024 KB
testcase_07 AC 1,343 ms
72,508 KB
testcase_08 AC 1,571 ms
75,884 KB
testcase_09 TLE -
testcase_10 AC 1,350 ms
76,432 KB
testcase_11 AC 1,938 ms
75,704 KB
testcase_12 AC 400 ms
66,628 KB
testcase_13 AC 722 ms
68,032 KB
testcase_14 AC 1,184 ms
74,728 KB
testcase_15 AC 712 ms
67,668 KB
testcase_16 AC 1,401 ms
75,884 KB
testcase_17 AC 1,184 ms
74,768 KB
testcase_18 AC 1,158 ms
70,108 KB
testcase_19 AC 1,544 ms
76,204 KB
testcase_20 AC 1,593 ms
75,888 KB
testcase_21 AC 1,457 ms
75,972 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
NMAX = 10**5

def main():
    import sys
    input = sys.stdin.readline

    for _ in range(int(input())):
        S, T = map(int, input().split())
        if T & 1:
            print(0)
            continue
        t = T // 2
        if (S * S) % t:
            print(0)
            continue
        U = S * S // t
        ans = []
        for A in range(1, NMAX):
            if A ** 3 > U:
                break
            if U % A:
                continue
            for B in range(A, NMAX):
                if A * B * B > U:
                    break
                if U % (A * B) == 0:
                    C = U // (A * B)
                    a = t - A
                    b = t - B
                    c = t - C
                    if a + b + c == T and a < b + c:
                        ans.append((a, b, c))
        print(len(ans))
        for a, b, c in ans:
            print(a, b, c)


if __name__ == '__main__':
    main()
0