結果

問題 No.2420 Simple Problem
ユーザー sepa38sepa38
提出日時 2023-07-17 12:21:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 701 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 914 ms
コンパイル使用メモリ 81,272 KB
実行使用メモリ 75,824 KB
最終ジャッジ日時 2023-10-18 00:21:04
合計ジャッジ時間 23,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,856 KB
testcase_01 AC 329 ms
75,796 KB
testcase_02 AC 70 ms
68,060 KB
testcase_03 AC 174 ms
75,792 KB
testcase_04 AC 567 ms
75,796 KB
testcase_05 AC 382 ms
75,792 KB
testcase_06 AC 694 ms
75,796 KB
testcase_07 AC 691 ms
75,796 KB
testcase_08 AC 697 ms
75,792 KB
testcase_09 AC 682 ms
75,800 KB
testcase_10 AC 688 ms
75,796 KB
testcase_11 AC 689 ms
75,792 KB
testcase_12 AC 691 ms
75,796 KB
testcase_13 AC 692 ms
75,796 KB
testcase_14 AC 680 ms
75,800 KB
testcase_15 AC 691 ms
75,796 KB
testcase_16 AC 701 ms
75,824 KB
testcase_17 AC 686 ms
75,800 KB
testcase_18 AC 692 ms
75,724 KB
testcase_19 AC 685 ms
75,744 KB
testcase_20 AC 693 ms
75,744 KB
testcase_21 AC 685 ms
75,728 KB
testcase_22 AC 693 ms
75,748 KB
testcase_23 AC 701 ms
75,744 KB
testcase_24 AC 683 ms
75,724 KB
testcase_25 AC 684 ms
75,740 KB
testcase_26 AC 40 ms
52,496 KB
testcase_27 AC 553 ms
75,708 KB
testcase_28 AC 561 ms
75,720 KB
testcase_29 AC 557 ms
75,720 KB
testcase_30 AC 555 ms
75,708 KB
testcase_31 AC 552 ms
75,708 KB
testcase_32 AC 40 ms
51,856 KB
testcase_33 AC 321 ms
75,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
  a, b = map(int, input().split())
  l, r = -1, 1 << 16
  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