結果
問題 |
No.2420 Simple Problem
|
ユーザー |
|
提出日時 | 2023-08-12 19:52:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 146 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 193,908 KB |
最終ジャッジ日時 | 2025-02-16 07:33:32 |
ジャッジサーバーID (参考情報) |
judge4 / 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(); } }