結果

問題 No.2420 Simple Problem
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-25 16:44:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 86,500 KB
実行使用メモリ 80,720 KB
最終ジャッジ日時 2023-08-25 16:44:42
合計ジャッジ時間 13,323 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
73,268 KB
testcase_01 AC 169 ms
80,128 KB
testcase_02 AC 124 ms
78,316 KB
testcase_03 AC 142 ms
79,804 KB
testcase_04 AC 207 ms
80,556 KB
testcase_05 AC 176 ms
80,052 KB
testcase_06 AC 231 ms
80,364 KB
testcase_07 AC 235 ms
80,368 KB
testcase_08 AC 257 ms
80,336 KB
testcase_09 AC 238 ms
80,396 KB
testcase_10 AC 231 ms
80,428 KB
testcase_11 AC 231 ms
80,696 KB
testcase_12 AC 265 ms
80,456 KB
testcase_13 AC 298 ms
80,636 KB
testcase_14 AC 233 ms
80,360 KB
testcase_15 AC 237 ms
80,684 KB
testcase_16 AC 236 ms
80,592 KB
testcase_17 AC 238 ms
80,492 KB
testcase_18 AC 231 ms
80,684 KB
testcase_19 AC 252 ms
80,580 KB
testcase_20 AC 274 ms
80,408 KB
testcase_21 AC 235 ms
80,564 KB
testcase_22 AC 259 ms
80,720 KB
testcase_23 AC 253 ms
80,424 KB
testcase_24 AC 271 ms
80,640 KB
testcase_25 AC 233 ms
80,452 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 125 ms
73,040 KB
testcase_33 AC 169 ms
80,104 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))
    y = x + 100
    while y-x>1:
        mid = (y+x)//2
        if is_ok(mid):
            y = mid
        else:
            x = mid
    print(y)
0