結果

問題 No.2420 Simple Problem
ユーザー siro53siro53
提出日時 2023-08-12 15:32:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 77,624 KB
最終ジャッジ日時 2024-04-30 09:40:56
合計ジャッジ時間 10,438 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
52,524 KB
testcase_01 AC 130 ms
76,260 KB
testcase_02 AC 54 ms
68,240 KB
testcase_03 AC 80 ms
75,996 KB
testcase_04 AC 221 ms
77,420 KB
testcase_05 AC 154 ms
76,448 KB
testcase_06 AC 253 ms
77,284 KB
testcase_07 AC 243 ms
77,540 KB
testcase_08 AC 246 ms
77,268 KB
testcase_09 AC 247 ms
77,052 KB
testcase_10 AC 242 ms
76,996 KB
testcase_11 AC 246 ms
77,200 KB
testcase_12 AC 247 ms
77,248 KB
testcase_13 AC 249 ms
77,340 KB
testcase_14 AC 252 ms
77,084 KB
testcase_15 AC 244 ms
77,496 KB
testcase_16 AC 244 ms
77,080 KB
testcase_17 AC 243 ms
77,604 KB
testcase_18 AC 247 ms
77,376 KB
testcase_19 AC 243 ms
77,624 KB
testcase_20 AC 252 ms
77,024 KB
testcase_21 AC 248 ms
77,208 KB
testcase_22 AC 242 ms
77,288 KB
testcase_23 AC 246 ms
77,152 KB
testcase_24 AC 253 ms
77,280 KB
testcase_25 AC 252 ms
77,096 KB
testcase_26 AC 34 ms
52,616 KB
testcase_27 AC 198 ms
76,972 KB
testcase_28 AC 197 ms
76,912 KB
testcase_29 AC 203 ms
76,760 KB
testcase_30 AC 195 ms
76,772 KB
testcase_31 AC 194 ms
76,780 KB
testcase_32 AC 32 ms
52,864 KB
testcase_33 AC 125 ms
76,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
for _ in range(N):
  A, B = map(int, input().split())
  ok, ng = 100000, 0
  while ok - ng > 1:
    mid = (ok + ng) // 2
    if mid * mid - A - B >= 0 and 4 * A * B < (mid * mid - A - B) ** 2:
      ok = mid
    else:
      ng = mid
  assert 4 * A * B < (ok * ok - A - B) ** 2
  print(ok)
0