結果
問題 | No.2420 Simple Problem |
ユーザー |
![]() |
提出日時 | 2023-08-12 13:45:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 621 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 2,087 ms |
コンパイル使用メモリ | 193,156 KB |
最終ジャッジ日時 | 2025-02-16 03:34:49 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longsigned main(){int Q;cin>>Q;while(Q--){int a,b;cin>>a>>b;int x = 2e9;for(int i=30;i>=0;i--){int y = x-(1<<i);if(y*y > a+b && y > 0) x = y;}int xx = x;x = 8e4;for(int i=30;i>=0;i--){int y = x-(1<<i);if(y < xx) continue;if(4*a*b < (y*y-a-b)*(y*y-a-b)) x = y;}cout<<x<<endl;}}