結果

問題 No.2420 Simple Problem
ユーザー とりゐとりゐ
提出日時 2023-08-12 13:35:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 492 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 79,488 KB
最終ジャッジ日時 2024-04-30 03:32:14
合計ジャッジ時間 17,118 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 233 ms
77,184 KB
testcase_02 AC 77 ms
70,144 KB
testcase_03 AC 144 ms
76,288 KB
testcase_04 AC 364 ms
78,592 KB
testcase_05 AC 265 ms
77,312 KB
testcase_06 AC 434 ms
78,848 KB
testcase_07 AC 466 ms
79,488 KB
testcase_08 AC 435 ms
78,848 KB
testcase_09 AC 467 ms
79,232 KB
testcase_10 AC 469 ms
78,976 KB
testcase_11 AC 471 ms
79,104 KB
testcase_12 AC 428 ms
78,720 KB
testcase_13 AC 457 ms
78,720 KB
testcase_14 AC 459 ms
79,488 KB
testcase_15 AC 460 ms
79,104 KB
testcase_16 AC 431 ms
78,848 KB
testcase_17 AC 431 ms
78,720 KB
testcase_18 AC 433 ms
78,848 KB
testcase_19 AC 466 ms
79,232 KB
testcase_20 AC 492 ms
79,232 KB
testcase_21 AC 431 ms
78,720 KB
testcase_22 AC 423 ms
78,720 KB
testcase_23 AC 434 ms
79,232 KB
testcase_24 AC 429 ms
78,976 KB
testcase_25 AC 431 ms
79,104 KB
testcase_26 AC 47 ms
58,368 KB
testcase_27 AC 377 ms
78,464 KB
testcase_28 AC 354 ms
78,080 KB
testcase_29 AC 358 ms
78,208 KB
testcase_30 AC 382 ms
78,592 KB
testcase_31 AC 381 ms
78,208 KB
testcase_32 AC 41 ms
51,968 KB
testcase_33 AC 234 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

def check(a,b,x):
  y=x*x-a-b
  if y>0 and y*y>4*a*b:
    return True
  return False

def solve():
  a,b=map(int,input().split())
  ng,ok=-1,3*10**9  
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if check(a,b,mid):
      ok=mid
    else:
      ng=mid
  print(ok)


for _ in range(int(input())):
  solve()
0