結果

問題 No.456 Millions of Submits!
ユーザー tubo28tubo28
提出日時 2016-12-08 01:59:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,015 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 8,368 KB
最終ジャッジ日時 2023-09-05 10:44:51
合計ジャッジ時間 9,732 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 10 ms
4,380 KB
testcase_08 AC 10 ms
4,376 KB
testcase_09 AC 86 ms
4,380 KB
testcase_10 AC 86 ms
4,376 KB
testcase_11 AC 840 ms
4,376 KB
testcase_12 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define NDEBUG
#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 f(int a, int b, double n) {
    return pow(n, a) * pow(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 < 64; ++i) {
            double mid = (lo + hi) / 2;
            if (f(a, b, mid) > t) {
                hi = mid;
            } else {
                lo = mid;
            }
        }
        return lo;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        double t;
        cin >> a >> b >> t;
        printf("%.10f\n", solve(a, b, t));
    }
}
0