結果

問題 No.2420 Simple Problem
ユーザー hotate29hotate29
提出日時 2023-08-15 05:23:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 730 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-05-02 17:32:11
合計ジャッジ時間 23,590 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,096 KB
testcase_01 AC 327 ms
76,160 KB
testcase_02 AC 62 ms
66,688 KB
testcase_03 AC 170 ms
76,160 KB
testcase_04 AC 604 ms
76,160 KB
testcase_05 AC 442 ms
76,032 KB
testcase_06 AC 689 ms
76,032 KB
testcase_07 AC 677 ms
76,416 KB
testcase_08 AC 694 ms
75,776 KB
testcase_09 AC 680 ms
75,904 KB
testcase_10 AC 716 ms
76,160 KB
testcase_11 AC 681 ms
75,776 KB
testcase_12 AC 702 ms
75,904 KB
testcase_13 AC 699 ms
76,288 KB
testcase_14 AC 707 ms
76,032 KB
testcase_15 AC 687 ms
76,416 KB
testcase_16 AC 730 ms
75,776 KB
testcase_17 AC 704 ms
75,776 KB
testcase_18 AC 713 ms
75,776 KB
testcase_19 AC 686 ms
76,288 KB
testcase_20 AC 723 ms
76,288 KB
testcase_21 AC 669 ms
76,416 KB
testcase_22 AC 677 ms
76,160 KB
testcase_23 AC 667 ms
75,776 KB
testcase_24 AC 690 ms
76,288 KB
testcase_25 AC 697 ms
76,288 KB
testcase_26 AC 37 ms
52,480 KB
testcase_27 AC 532 ms
76,032 KB
testcase_28 AC 541 ms
76,160 KB
testcase_29 AC 608 ms
76,032 KB
testcase_30 AC 605 ms
76,032 KB
testcase_31 AC 538 ms
76,160 KB
testcase_32 AC 35 ms
51,840 KB
testcase_33 AC 314 ms
75,904 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