結果

問題 No.2420 Simple Problem
ユーザー sepa38
提出日時 2023-07-17 12:20:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,884 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,732 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-12-20 18:06:29
合計ジャッジ時間 57,405 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
  a, b = map(int, input().split())
  l, r = -1, 1 << 20
  while r - l > 1:
    x = (l + r) // 2
    if 0 < (x ** 2 - (a + b)) ** 2 - 4 * a * b and x ** 2 - (a + b) > 0:
      r = x
    else:
      l = x
  print(r)
0