結果

問題 No.2420 Simple Problem
ユーザー 遭難者遭難者
提出日時 2023-08-12 13:32:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 673 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 76,760 KB
最終ジャッジ日時 2024-04-30 03:24:03
合計ジャッジ時間 24,115 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,968 KB
testcase_01 AC 303 ms
75,896 KB
testcase_02 AC 61 ms
68,608 KB
testcase_03 AC 158 ms
76,280 KB
testcase_04 AC 566 ms
76,288 KB
testcase_05 AC 372 ms
75,948 KB
testcase_06 AC 673 ms
76,032 KB
testcase_07 AC 667 ms
76,376 KB
testcase_08 AC 659 ms
75,916 KB
testcase_09 AC 646 ms
76,144 KB
testcase_10 AC 657 ms
76,760 KB
testcase_11 AC 659 ms
76,032 KB
testcase_12 AC 651 ms
76,008 KB
testcase_13 AC 657 ms
76,200 KB
testcase_14 AC 665 ms
76,160 KB
testcase_15 AC 663 ms
76,084 KB
testcase_16 AC 649 ms
76,160 KB
testcase_17 AC 661 ms
75,824 KB
testcase_18 AC 656 ms
76,416 KB
testcase_19 AC 654 ms
76,032 KB
testcase_20 AC 632 ms
76,288 KB
testcase_21 AC 655 ms
76,140 KB
testcase_22 AC 660 ms
76,304 KB
testcase_23 AC 646 ms
76,160 KB
testcase_24 AC 668 ms
76,416 KB
testcase_25 AC 654 ms
76,384 KB
testcase_26 AC 36 ms
52,640 KB
testcase_27 AC 537 ms
76,372 KB
testcase_28 AC 541 ms
76,308 KB
testcase_29 AC 542 ms
76,288 KB
testcase_30 AC 538 ms
76,088 KB
testcase_31 AC 530 ms
76,160 KB
testcase_32 AC 36 ms
52,224 KB
testcase_33 AC 306 ms
76,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    a, b = map(int, input().split())
    ok, ng = 10**5, 0
    while ok - ng != 1:
        vs = (ok + ng) >> 1
        jud = vs * vs - a - b
        if jud < 0:
            ng = vs
            continue
        if 4 * a * b < jud * jud:
            ok = vs
        else:
            ng = vs
    print(ok)
0