結果

問題 No.2420 Simple Problem
ユーザー hotate29hotate29
提出日時 2023-08-12 14:30:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 751 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 76,548 KB
最終ジャッジ日時 2024-04-30 06:18:42
合計ジャッジ時間 23,356 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,616 KB
testcase_01 AC 335 ms
76,044 KB
testcase_02 AC 60 ms
68,292 KB
testcase_03 AC 164 ms
75,832 KB
testcase_04 AC 601 ms
76,400 KB
testcase_05 AC 414 ms
76,224 KB
testcase_06 AC 713 ms
76,088 KB
testcase_07 AC 712 ms
76,052 KB
testcase_08 AC 718 ms
75,904 KB
testcase_09 AC 720 ms
75,944 KB
testcase_10 AC 729 ms
75,900 KB
testcase_11 AC 725 ms
75,896 KB
testcase_12 AC 715 ms
76,020 KB
testcase_13 AC 720 ms
76,040 KB
testcase_14 AC 751 ms
76,212 KB
testcase_15 AC 726 ms
76,020 KB
testcase_16 AC 741 ms
76,012 KB
testcase_17 AC 714 ms
76,448 KB
testcase_18 AC 714 ms
76,548 KB
testcase_19 AC 718 ms
76,372 KB
testcase_20 AC 720 ms
75,892 KB
testcase_21 AC 723 ms
75,840 KB
testcase_22 AC 726 ms
76,028 KB
testcase_23 AC 712 ms
76,096 KB
testcase_24 AC 720 ms
76,364 KB
testcase_25 AC 714 ms
76,452 KB
testcase_26 AC 36 ms
53,072 KB
testcase_27 AC 574 ms
76,104 KB
testcase_28 AC 578 ms
75,960 KB
testcase_29 AC 578 ms
76,076 KB
testcase_30 AC 575 ms
76,088 KB
testcase_31 AC 584 ms
75,964 KB
testcase_32 AC 36 ms
52,612 KB
testcase_33 AC 328 ms
76,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
for _ in range(n):
    a, b = map(int, input().split())
    # 二分探索したくなる
    # 不等式からルートを消したい
    ok = 100000
    ng = -1
    while (ok - ng) > 1:
        mid = (ok + ng) // 2
        if 4 * a * b < (mid * mid - a - b) ** 2 and 0 < mid * mid - a - b:
            ok = mid
        else:
            ng = mid
    print(ok)
0