結果

問題 No.2420 Simple Problem
ユーザー だれだれ
提出日時 2023-08-12 14:29:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 664 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 82,048 KB
最終ジャッジ日時 2024-04-30 06:15:46
合計ジャッジ時間 21,004 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
51,712 KB
testcase_01 AC 294 ms
78,208 KB
testcase_02 AC 53 ms
71,840 KB
testcase_03 AC 145 ms
76,544 KB
testcase_04 AC 502 ms
80,624 KB
testcase_05 AC 353 ms
78,976 KB
testcase_06 AC 634 ms
82,008 KB
testcase_07 AC 623 ms
81,976 KB
testcase_08 AC 629 ms
81,920 KB
testcase_09 AC 610 ms
81,920 KB
testcase_10 AC 627 ms
81,912 KB
testcase_11 AC 628 ms
81,792 KB
testcase_12 AC 642 ms
81,768 KB
testcase_13 AC 625 ms
82,048 KB
testcase_14 AC 631 ms
82,044 KB
testcase_15 AC 623 ms
81,936 KB
testcase_16 AC 625 ms
81,780 KB
testcase_17 AC 640 ms
81,808 KB
testcase_18 AC 624 ms
81,792 KB
testcase_19 AC 622 ms
81,664 KB
testcase_20 AC 615 ms
81,628 KB
testcase_21 AC 631 ms
81,784 KB
testcase_22 AC 642 ms
81,692 KB
testcase_23 AC 664 ms
81,824 KB
testcase_24 AC 641 ms
81,664 KB
testcase_25 AC 624 ms
81,784 KB
testcase_26 AC 33 ms
53,120 KB
testcase_27 AC 543 ms
81,152 KB
testcase_28 AC 545 ms
80,876 KB
testcase_29 AC 534 ms
81,016 KB
testcase_30 AC 546 ms
81,132 KB
testcase_31 AC 551 ms
80,944 KB
testcase_32 AC 32 ms
52,352 KB
testcase_33 AC 294 ms
78,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline

n = int(input())
for i in range(n):
    a, b = map(int, input().split())
    assert a > 0 and b > 0
    c = a + b
    d = (a - b) ** 2
    hi = 63246
    lw = 0
    while hi - lw > 1:
        mid = (hi + lw) // 2
        if mid ** 2 - c <= 0:
            lw = mid
            continue
        if mid ** 4 - (2 * (mid ** 2) * c) + d > 0:
            hi = mid
        else:
            lw = mid
    print(hi)
0