結果

問題 No.2420 Simple Problem
ユーザー 👑 Nafmo2Nafmo2
提出日時 2023-06-20 20:07:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 563 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 1,874 ms
コンパイル使用メモリ 198,516 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 20:23:58
合計ジャッジ時間 20,620 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 229 ms
4,380 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 85 ms
4,380 KB
testcase_04 AC 442 ms
4,376 KB
testcase_05 AC 283 ms
4,380 KB
testcase_06 AC 552 ms
4,376 KB
testcase_07 AC 552 ms
4,380 KB
testcase_08 AC 551 ms
4,376 KB
testcase_09 AC 555 ms
4,380 KB
testcase_10 AC 554 ms
4,376 KB
testcase_11 AC 557 ms
4,384 KB
testcase_12 AC 562 ms
4,380 KB
testcase_13 AC 553 ms
4,380 KB
testcase_14 AC 559 ms
4,376 KB
testcase_15 AC 553 ms
4,380 KB
testcase_16 AC 557 ms
4,380 KB
testcase_17 AC 555 ms
4,380 KB
testcase_18 AC 555 ms
4,376 KB
testcase_19 AC 557 ms
4,376 KB
testcase_20 AC 563 ms
4,376 KB
testcase_21 AC 553 ms
4,380 KB
testcase_22 AC 558 ms
4,376 KB
testcase_23 AC 551 ms
4,376 KB
testcase_24 AC 551 ms
4,376 KB
testcase_25 AC 555 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 438 ms
4,376 KB
testcase_28 AC 443 ms
4,380 KB
testcase_29 AC 442 ms
4,380 KB
testcase_30 AC 439 ms
4,380 KB
testcase_31 AC 438 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 221 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
	  uint64_t A, B, mid;
	  cin >> A >> B;
	  int ok = 70000, ng = 2;
	  while (abs(ok - ng) > 1) {
	    mid = (ok + ng) / 2;
	    uint64_t Y = ((mid * mid) - A - B);
	    if (4 * A * B < Y * Y && mid * mid > A + B) {
	      ok = mid;
	    } else {
	      ng = mid;
	    }
	  }
	cout << ok << endl;
  }
}
0