結果
問題 |
No.2420 Simple Problem
|
ユーザー |
![]() |
提出日時 | 2023-08-12 14:13:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 1,681 ms |
コンパイル使用メモリ | 166,996 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-19 17:54:54 |
合計ジャッジ時間 | 7,634 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++) #define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--) #define all(v) v.begin(), v.end() typedef long long ll; template <class T> using V = vector<T>; template <class T> using VV = vector<V<T>>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); constexpr char endl = '\n'; int n; cin >> n; while (n--) { ll a,b; cin >> a >> b; ll x = sqrt(a) + sqrt(b); x--; while (1) { ll num1 = 4LL * a * b; ll num2 = x * x - a - b; if (num2 > sqrt(num1)) { cout << x << endl; break; } x++; } } return 0; }