結果

問題 No.456 Millions of Submits!
ユーザー tubo28tubo28
提出日時 2016-12-08 02:20:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,154 bytes
コンパイル時間 1,854 ms
コンパイル使用メモリ 75,600 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 11:03:37
合計ジャッジ時間 8,744 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 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 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cassert>
#include <ctime>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include <cmath>

#define dump(x) std::cerr << __LINE__ << ":\t" #x " = " << x << std::endl
using namespace std;

double mypow(double x, int y) {
    double res = 1;
    while (y) {
        res *= res;
        if (y & 1) res *= x;
        y /= 2;
    }
    return res;
}

double f(int a, int b, double n) {
    return mypow(n, a) * mypow(log(n), b);
}

double solve(double a, double b, double t) {
    if (b == 0) {
        return pow(t, 1.0 / a);
    } else if (a == 0) {
        return exp(pow(t, 1.0 / b));
    } else {
        double lo = 1.0, hi = 6.0;
        for (int i = 0; i < 60; ++i) {
            double mid = (lo + hi) / 2;
            if (f(a, b, mid) > t) {
                hi = mid;
            } else {
                lo = mid;
            }
        }
        return lo;
    }
}

int main() {
    int m;
    cin >> m;
    cout << fixed;
    cout.precision(10);
    for (int i = 0; i < m; i++) {
        int a, b;
        double t;
        cin >> a >> b >> t;
        cout << solve(a, b, t) << '\n';
    }
}
0