結果
問題 | No.2420 Simple Problem |
ユーザー | Nzt3 |
提出日時 | 2023-08-12 19:52:07 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 2,015 ms |
コンパイル使用メモリ | 199,896 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-20 10:38:30 |
合計ジャッジ時間 | 10,029 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; void solve(){ ll A,B; cin>>A>>B; ll V=4*A*B; __int128_t l=1,ans=100'000; while(ans-l>1){ __int128_t mid=(l+ans)/2; if((mid*mid-A-B)<0||(mid*mid-A-B)*(mid*mid-A-B)<=4*A*B)l=mid; else ans=mid; } ll ret=ans; cout<<ret<<'\n'; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; while(T--){ solve(); } }