結果

問題 No.2420 Simple Problem
ユーザー ryota2357ryota2357
提出日時 2023-07-11 14:22:55
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 3,483 ms
コンパイル使用メモリ 89,680 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-11 05:30:53
合計ジャッジ時間 33,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 432 ms
4,348 KB
testcase_28 AC 427 ms
4,348 KB
testcase_29 AC 427 ms
4,348 KB
testcase_30 AC 433 ms
4,348 KB
testcase_31 AC 428 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;

void solve() {
    ll a, b;
    cin >> a >> b;
    ull min_x = max<ull>(1, sqrt(a) + sqrt(b) - 1);
    ull x = min_x;
    while(1) {
        ull x4 = x * x * x * x;
        ull sb = 2 * x * x * (a + b);
        if (a == b) {
            if (x4 > sb) { // x4 - sb > 0
                cout << x << endl;
                return;
            }
        } else {
            if (x4 >= sb) { // x4 - sb >= 0
                cout << x << endl;
                return;
            }
        }
        x += 1;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        solve();
    }
    return 0;
}
0