結果

問題 No.2420 Simple Problem
ユーザー LaFolia13LaFolia13
提出日時 2023-07-29 17:28:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 568 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 162,464 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 22:58:01
合計ジャッジ時間 20,390 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 227 ms
5,376 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 AC 84 ms
5,376 KB
testcase_04 AC 447 ms
5,376 KB
testcase_05 AC 293 ms
5,376 KB
testcase_06 AC 554 ms
5,376 KB
testcase_07 AC 546 ms
5,376 KB
testcase_08 AC 555 ms
5,376 KB
testcase_09 AC 555 ms
5,376 KB
testcase_10 AC 547 ms
5,376 KB
testcase_11 AC 540 ms
5,376 KB
testcase_12 AC 554 ms
5,376 KB
testcase_13 AC 552 ms
5,376 KB
testcase_14 AC 565 ms
5,376 KB
testcase_15 AC 556 ms
5,376 KB
testcase_16 AC 556 ms
5,376 KB
testcase_17 AC 550 ms
5,376 KB
testcase_18 AC 555 ms
5,376 KB
testcase_19 AC 554 ms
5,376 KB
testcase_20 AC 555 ms
5,376 KB
testcase_21 AC 552 ms
5,376 KB
testcase_22 AC 550 ms
5,376 KB
testcase_23 AC 548 ms
5,376 KB
testcase_24 AC 568 ms
5,376 KB
testcase_25 AC 558 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 445 ms
5,376 KB
testcase_28 AC 434 ms
5,376 KB
testcase_29 AC 454 ms
5,376 KB
testcase_30 AC 440 ms
5,376 KB
testcase_31 AC 445 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 220 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ullong = unsigned long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

int main() {
  llong N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    ullong A, B;
    cin >> A >> B;

    ullong ng = 0, ok = 64000;
    while (ok - ng > 1) {
      ullong mid = (ok + ng) / 2;
      if (mid * mid >= A + B && 4 * A * B < (mid * mid - A - B) * (mid * mid - A - B)) {
        ok = mid;
      }
      else {
        ng = mid;
      }
    }

    cout << ok << endl;
  }

  return 0;
}
0