結果

問題 No.2420 Simple Problem
ユーザー Nikkuniku029Nikkuniku029
提出日時 2023-08-12 14:29:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,752 KB
最終ジャッジ日時 2024-04-30 06:20:33
合計ジャッジ時間 67,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 1,060 ms
17,280 KB
testcase_02 AC 36 ms
10,752 KB
testcase_03 AC 402 ms
13,312 KB
testcase_04 AC 1,947 ms
23,296 KB
testcase_05 AC 1,259 ms
18,688 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 26 ms
10,752 KB
testcase_27 AC 1,879 ms
23,424 KB
testcase_28 AC 1,908 ms
23,424 KB
testcase_29 AC 1,936 ms
23,424 KB
testcase_30 AC 1,907 ms
23,296 KB
testcase_31 AC 1,908 ms
23,552 KB
testcase_32 AC 25 ms
10,752 KB
testcase_33 AC 996 ms
17,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(a, b):
    l = 1
    r = 64000
    P = 4*a*b
    while r-l > 1:
        mid = (l+r)//2
        Q = mid**2 - a - b
        R = Q**2
        if Q > 0:
            if P < R:
                r = mid
            else:
                l = mid
        else:
            l = mid
    return r


N = int(input())
ans = []
for _ in range(N):
    A, B = map(int, input().split())
    ans.append(solve(A, B))
print(*ans, sep="\n")
0