結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint1000000007;
#define rep(i, n) for(ll i = 0; i < n; i++)

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cout << setprecision(10) << fixed;
    
    ll n; cin >> n;
    vector<long double> a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    rep(i,n) {
        ll left = 1, right = 1e16;
        while( right-left > 1 ) {
            ll mid = (right+left)/2;
            bool f = ( (long double)(sqrt(a[i])+sqrt(b[i])) < (long double)mid);
            if( f ) right = mid;
            else left = mid;
        }
        cout << right << endl;
    }
    
    return 0;
}
0