結果

問題 No.1626 三角形の構築
ユーザー tamatotamato
提出日時 2021-07-23 23:04:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,029 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,760 KB
実行使用メモリ 82,724 KB
最終ジャッジ日時 2024-04-20 16:02:22
合計ジャッジ時間 32,474 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
67,920 KB
testcase_01 AC 1,472 ms
75,776 KB
testcase_02 AC 42 ms
52,864 KB
testcase_03 AC 42 ms
52,096 KB
testcase_04 AC 42 ms
52,864 KB
testcase_05 AC 41 ms
52,480 KB
testcase_06 AC 41 ms
52,096 KB
testcase_07 AC 1,443 ms
71,808 KB
testcase_08 AC 1,712 ms
76,032 KB
testcase_09 TLE -
testcase_10 AC 1,481 ms
75,520 KB
testcase_11 TLE -
testcase_12 AC 434 ms
65,664 KB
testcase_13 AC 773 ms
67,072 KB
testcase_14 AC 1,289 ms
74,880 KB
testcase_15 AC 770 ms
66,944 KB
testcase_16 AC 1,501 ms
76,032 KB
testcase_17 AC 1,298 ms
74,448 KB
testcase_18 AC 1,255 ms
68,736 KB
testcase_19 AC 1,670 ms
76,160 KB
testcase_20 AC 1,741 ms
75,980 KB
testcase_21 AC 1,595 ms
75,776 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 (t - A) * 2 >= T:
                continue
            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