結果

問題 No.2420 Simple Problem
ユーザー noriocnorioc
提出日時 2023-08-12 16:59:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 716 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,592 KB
最終ジャッジ日時 2024-04-30 12:01:18
合計ジャッジ時間 21,802 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
53,260 KB
testcase_01 AC 296 ms
76,456 KB
testcase_02 AC 62 ms
73,968 KB
testcase_03 AC 147 ms
76,312 KB
testcase_04 AC 545 ms
76,592 KB
testcase_05 AC 359 ms
76,056 KB
testcase_06 AC 642 ms
76,400 KB
testcase_07 AC 654 ms
76,020 KB
testcase_08 AC 657 ms
76,200 KB
testcase_09 AC 701 ms
76,396 KB
testcase_10 AC 650 ms
76,024 KB
testcase_11 AC 673 ms
76,044 KB
testcase_12 AC 654 ms
76,304 KB
testcase_13 AC 675 ms
76,052 KB
testcase_14 AC 665 ms
76,472 KB
testcase_15 AC 716 ms
76,052 KB
testcase_16 AC 707 ms
76,372 KB
testcase_17 AC 633 ms
76,144 KB
testcase_18 AC 670 ms
76,412 KB
testcase_19 AC 654 ms
76,292 KB
testcase_20 AC 647 ms
76,440 KB
testcase_21 AC 661 ms
76,136 KB
testcase_22 AC 659 ms
75,984 KB
testcase_23 AC 646 ms
76,196 KB
testcase_24 AC 641 ms
76,472 KB
testcase_25 AC 653 ms
76,036 KB
testcase_26 AC 35 ms
54,628 KB
testcase_27 AC 522 ms
76,252 KB
testcase_28 AC 524 ms
76,032 KB
testcase_29 AC 518 ms
76,248 KB
testcase_30 AC 511 ms
75,972 KB
testcase_31 AC 530 ms
76,224 KB
testcase_32 AC 33 ms
52,320 KB
testcase_33 AC 295 ms
76,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def issatisfy(m, a, b) -> bool:
    s = m**2 - (a + b)
    if s <= 0: return False
    return 4*a*b < s**2


# INF = 1 << 60
INF = 10 ** 5
N = int(input())
for _ in range(N):
    A, B = map(int, input().split())

    lo = 1
    hi = INF
    ans = INF
    while lo <= hi:
        m = (lo + hi) // 2
        if issatisfy(m, A, B):
            ans = min(ans, m)
            hi = m - 1
        else:
            lo = m + 1
    print(ans)
0