結果
問題 | No.2420 Simple Problem |
ユーザー | keisuke6 |
提出日時 | 2023-08-12 13:45:42 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 589 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 2,049 ms |
コンパイル使用メモリ | 200,748 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-19 16:06:46 |
合計ジャッジ時間 | 21,362 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed 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; } }