結果

問題 No.2420 Simple Problem
ユーザー 👑 KA37RIKA37RI
提出日時 2023-08-12 18:10:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 79,000 KB
最終ジャッジ日時 2024-04-30 13:17:47
合計ジャッジ時間 11,332 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,864 KB
testcase_01 AC 149 ms
77,412 KB
testcase_02 AC 49 ms
65,648 KB
testcase_03 AC 107 ms
77,096 KB
testcase_04 AC 222 ms
78,324 KB
testcase_05 AC 166 ms
77,636 KB
testcase_06 AC 253 ms
78,380 KB
testcase_07 AC 270 ms
78,536 KB
testcase_08 AC 259 ms
78,664 KB
testcase_09 AC 257 ms
78,752 KB
testcase_10 AC 262 ms
79,000 KB
testcase_11 AC 280 ms
78,580 KB
testcase_12 AC 271 ms
78,804 KB
testcase_13 AC 264 ms
78,660 KB
testcase_14 AC 276 ms
78,552 KB
testcase_15 AC 263 ms
78,480 KB
testcase_16 AC 265 ms
78,940 KB
testcase_17 AC 267 ms
78,732 KB
testcase_18 AC 257 ms
78,756 KB
testcase_19 AC 262 ms
78,584 KB
testcase_20 AC 271 ms
78,800 KB
testcase_21 AC 258 ms
78,540 KB
testcase_22 AC 256 ms
78,752 KB
testcase_23 AC 252 ms
78,768 KB
testcase_24 AC 259 ms
78,684 KB
testcase_25 AC 257 ms
78,964 KB
testcase_26 AC 35 ms
52,464 KB
testcase_27 AC 231 ms
78,172 KB
testcase_28 AC 236 ms
78,072 KB
testcase_29 AC 230 ms
78,416 KB
testcase_30 AC 221 ms
77,900 KB
testcase_31 AC 239 ms
78,168 KB
testcase_32 AC 34 ms
52,872 KB
testcase_33 AC 146 ms
77,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input = stdin.readline

def solve(A, B):
  C = A + B
  D = A - B
  left = 0
  right = 64000
  while right - left > 1:
    mid = (left + right) // 2
    X2 = mid * mid
    if X2 - C >= 0 and D * D > X2 * (2 * C - X2):
      right = mid
    else:
      left = mid
  return right

N = int(input())
for _ in range(N):
  A, B = [int(x) for x in input().split()]
  print(solve(A, B))
0