結果

問題 No.456 Millions of Submits!
ユーザー はむこはむこ
提出日時 2016-12-06 09:50:33
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 2,072 bytes
コンパイル時間 1,220 ms
コンパイル使用メモリ 144,744 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-05 05:36:07
合計ジャッジ時間 9,944 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) {  o << "(" << v.first << ", " << v.second << ")"; return o; }
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if (!v.empty()) { o << '['; copy(v.begin(), v.end(), ostream_iterator<T>(o, ", ")); o << "\b\b]"; } return o; }
using ll = long long;  using vll = vector<ll>; using vi = vector<int>;
typedef pair<ll, ll> P;

static const double EPS = 1e-14;
static const long long INF = 1e18;
#define MAX_N 100005

typedef double Double;

int main(void) {
    int m; scanf("%d", &m);
    Double maxerr = -INF;
    rep(i, m) {
        int a, b; scanf("%d%d", &a, &b);
        Double t; scanf("%lf", &t);
//        cout << a << " " << b << " " << t << endl;
        if (!a) {
//            cout << "a=0" << endl;
            printf("%.12f\n", exp(pow(t, 1.0 / b)));
            continue;
        }
        if (!b) {
//            cout << "b=0" << endl;
            printf("%.12f\n", pow(t, 1.0 / a));
            continue;
        }

        Double rl = 0.1;
        Double rr = 10;
        Double prev_m = 100;
        Double m;
        rep(i, 9) { 
            m = (rl + rr) / 2;
            (pow(m, a) * pow(log(m), b) - t > 0) ? rr = m : rl = m;
            m = (rl + rr) / 2;
            (pow(m, a) * pow(log(m), b) - t > 0) ? rr = m : rl = m;
            m = (rl + rr) / 2;
            (pow(m, a) * pow(log(m), b) - t > 0) ? rr = m : rl = m;
            m = (rl + rr) / 2;
            (pow(m, a) * pow(log(m), b) - t > 0) ? rr = m : rl = m;
        }
        Double n = rl;
        printf("%.10f\n", n);

//        Double err = pow(n, a) * pow(log(n), b) -  t;
//        cout << err << endl;
    }

    return 0;
}
0