結果

問題 No.2420 Simple Problem
ユーザー noriocnorioc
提出日時 2023-08-12 16:58:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 811 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 76,484 KB
最終ジャッジ日時 2024-04-30 11:59:11
合計ジャッジ時間 24,606 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,936 KB
testcase_01 AC 349 ms
76,116 KB
testcase_02 AC 72 ms
73,864 KB
testcase_03 AC 176 ms
75,976 KB
testcase_04 AC 636 ms
76,336 KB
testcase_05 AC 418 ms
76,268 KB
testcase_06 AC 743 ms
76,256 KB
testcase_07 AC 756 ms
76,080 KB
testcase_08 AC 759 ms
76,404 KB
testcase_09 AC 811 ms
76,240 KB
testcase_10 AC 743 ms
76,252 KB
testcase_11 AC 736 ms
76,484 KB
testcase_12 AC 769 ms
76,320 KB
testcase_13 AC 745 ms
76,380 KB
testcase_14 AC 764 ms
76,424 KB
testcase_15 AC 749 ms
76,204 KB
testcase_16 AC 748 ms
76,088 KB
testcase_17 AC 747 ms
76,088 KB
testcase_18 AC 741 ms
76,044 KB
testcase_19 AC 753 ms
76,420 KB
testcase_20 AC 751 ms
76,104 KB
testcase_21 AC 761 ms
76,140 KB
testcase_22 AC 776 ms
76,040 KB
testcase_23 AC 753 ms
76,028 KB
testcase_24 AC 753 ms
76,308 KB
testcase_25 AC 783 ms
76,120 KB
testcase_26 AC 40 ms
53,352 KB
testcase_27 AC 596 ms
76,432 KB
testcase_28 AC 610 ms
75,976 KB
testcase_29 AC 595 ms
76,192 KB
testcase_30 AC 603 ms
76,228 KB
testcase_31 AC 600 ms
76,460 KB
testcase_32 AC 39 ms
52,984 KB
testcase_33 AC 345 ms
76,264 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