結果

問題 No.2420 Simple Problem
ユーザー KudeKude
提出日時 2023-08-12 13:51:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 688 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-04-30 04:17:31
合計ジャッジ時間 22,261 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,968 KB
testcase_01 AC 317 ms
76,032 KB
testcase_02 AC 68 ms
65,920 KB
testcase_03 AC 154 ms
76,416 KB
testcase_04 AC 544 ms
76,416 KB
testcase_05 AC 372 ms
76,416 KB
testcase_06 AC 654 ms
76,332 KB
testcase_07 AC 652 ms
76,252 KB
testcase_08 AC 653 ms
75,992 KB
testcase_09 AC 658 ms
76,152 KB
testcase_10 AC 662 ms
76,360 KB
testcase_11 AC 671 ms
76,020 KB
testcase_12 AC 661 ms
75,776 KB
testcase_13 AC 641 ms
75,964 KB
testcase_14 AC 667 ms
75,992 KB
testcase_15 AC 663 ms
76,084 KB
testcase_16 AC 659 ms
76,032 KB
testcase_17 AC 688 ms
76,128 KB
testcase_18 AC 642 ms
76,032 KB
testcase_19 AC 665 ms
76,004 KB
testcase_20 AC 664 ms
75,948 KB
testcase_21 AC 644 ms
76,380 KB
testcase_22 AC 647 ms
75,776 KB
testcase_23 AC 681 ms
76,076 KB
testcase_24 AC 661 ms
75,980 KB
testcase_25 AC 679 ms
75,972 KB
testcase_26 AC 39 ms
52,352 KB
testcase_27 AC 542 ms
76,332 KB
testcase_28 AC 542 ms
75,740 KB
testcase_29 AC 538 ms
75,776 KB
testcase_30 AC 544 ms
75,760 KB
testcase_31 AC 548 ms
76,148 KB
testcase_32 AC 39 ms
52,088 KB
testcase_33 AC 318 ms
76,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    a, b = map(int, input().split())
    l = 0
    r = 63246
    S = a + b
    T = 4 * a * b
    while r - l > 1:
        x = (l + r) // 2
        x2 = x * x
        if x2 >= S and T < (x2 - S) ** 2:
            r = x
        else:
            l = x
    print(r)
0