結果

問題 No.2420 Simple Problem
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-25 16:45:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 81,080 KB
最終ジャッジ日時 2023-08-25 16:45:46
合計ジャッジ時間 12,331 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,928 KB
testcase_01 AC 180 ms
80,296 KB
testcase_02 AC 128 ms
78,588 KB
testcase_03 AC 154 ms
80,228 KB
testcase_04 AC 217 ms
80,788 KB
testcase_05 AC 186 ms
80,456 KB
testcase_06 AC 241 ms
80,816 KB
testcase_07 AC 241 ms
80,764 KB
testcase_08 AC 249 ms
81,004 KB
testcase_09 AC 246 ms
80,760 KB
testcase_10 AC 248 ms
80,832 KB
testcase_11 AC 245 ms
80,720 KB
testcase_12 AC 242 ms
80,984 KB
testcase_13 AC 240 ms
80,944 KB
testcase_14 AC 240 ms
80,944 KB
testcase_15 AC 240 ms
80,840 KB
testcase_16 AC 241 ms
80,708 KB
testcase_17 AC 238 ms
81,068 KB
testcase_18 AC 243 ms
80,908 KB
testcase_19 AC 243 ms
80,864 KB
testcase_20 AC 242 ms
80,828 KB
testcase_21 AC 243 ms
80,816 KB
testcase_22 AC 245 ms
80,748 KB
testcase_23 AC 265 ms
80,904 KB
testcase_24 AC 247 ms
80,756 KB
testcase_25 AC 251 ms
81,080 KB
testcase_26 AC 105 ms
72,900 KB
testcase_27 AC 214 ms
80,484 KB
testcase_28 AC 243 ms
80,492 KB
testcase_29 AC 216 ms
80,540 KB
testcase_30 AC 214 ms
80,580 KB
testcase_31 AC 214 ms
80,580 KB
testcase_32 AC 105 ms
73,108 KB
testcase_33 AC 204 ms
80,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
for _ in range(N):
    a,b = map(int,input().split())
    
    is_ok = lambda x : 4*a*b < (x**2 - a - b)**2

    x = math.floor(math.sqrt(a)+math.sqrt(b))-2
    while is_ok(x):
        x += 1
    y = x + 100
    while y-x>1:
        mid = (y+x)//2
        if is_ok(mid):
            y = mid
        else:
            x = mid
    print(y)
0