結果
| 問題 |
No.2420 Simple Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-29 21:56:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 569 bytes |
| コンパイル時間 | 1,672 ms |
| コンパイル使用メモリ | 167,052 KB |
| 実行使用メモリ | 16,848 KB |
| 最終ジャッジ日時 | 2024-12-31 00:13:19 |
| 合計ジャッジ時間 | 86,472 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 TLE * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define ld long double
const ld sq = sqrt(1e9+10)*2;
const ld eps = 1e-8;
void solve(){
ll a,b;
cin>>a>>b;
ll l = 0,r = sq+1;
while(l != r){
ll mid = (l+r)>>1;
ll C = mid*mid-a-b;
if(C<0)l = mid+1;
if(C*C>a*b*4)r = mid;
else l = mid+1;
}
cout<<l<<'\n';
return;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--)solve();
}