結果
問題 |
No.2420 Simple Problem
|
ユーザー |
![]() |
提出日時 | 2023-08-12 14:11:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 522 bytes |
コンパイル時間 | 2,227 ms |
コンパイル使用メモリ | 191,708 KB |
最終ジャッジ日時 | 2025-02-16 04:20:50 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 27 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef unsigned long long ll; #include<bits/stdc++.h> using namespace std; ll f(ll a,ll b){ ll ok=63250,ng=0; while(ok-ng>1){ ll m=(ok+ng)/2; if(m*m-a-b<0) ng=m; else if(m*m*m*m+a*a+b*b>2*(a*m*m+b*m*m+a*b)) ok=m; else ng=m; } return ok; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; rep(i,n){ ll a,b; cin>>a>>b; cout<<f(a,b)<<'\n'; } return 0; }