結果
| 問題 |
No.2420 Simple Problem
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-08-20 19:58:56 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 618 ms / 2,000 ms |
| コード長 | 633 bytes |
| コンパイル時間 | 5,772 ms |
| コンパイル使用メモリ | 139,996 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-14 02:03:11 |
| 合計ジャッジ時間 | 26,265 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 33 |
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
ll a, b;
cin >> a >> b;
ll ok = 1000000000;
ll ng = 0;
while (abs(ok - ng) >= 2) {
__int128 x = (ok + ng) / 2;
__int128 v = x * x - (a + b);
if (v >= 0 && 4 * a * b < v * v) {
ok = x;
} else {
ng = x;
}
}
cout << ok << endl;
}
return 0;
}
siman