結果

問題 No.2420 Simple Problem
ユーザー umezo
提出日時 2023-08-12 13:52:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 191,448 KB
最終ジャッジ日時 2025-02-16 03:49:10
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

ll f(ll a,ll b){
  ll ok=35000,ng=0;
  while(ok-ng>1){
    ll m=(ok+ng)/2;
    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;
}
0