結果

問題 No.456 Millions of Submits!
ユーザー tubo28tubo28
提出日時 2016-12-08 02:29:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,273 ms / 4,500 ms
コード長 3,126 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 77,196 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 11:11:48
合計ジャッジ時間 11,504 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#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;

//#define mygc(c) (c)=getchar_unlocked()
//#define mypc(c) putchar_unlocked(c)

#define mygc(c) (c)=getchar();
#define mypc(c) putchar(c)

#define ll long long
#define ull unsigned ll

void reader(int *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); }
void reader(ll *x) { int k, m = 0; *x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { *x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; *x = (*x) * 10 + k - '0'; }if (m)(*x) = -(*x); }
void reader(double *x) { scanf("%lf", x); }
int reader(char c[]) { int i, s = 0; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c[s++] = i; for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c[s++] = i; }c[s] = '\0'; return s; }
template <class T, class S> void reader(T *x, S *y) { reader(x); reader(y); }
template <class T, class S, class U> void reader(T *x, S *y, U *z) { reader(x); reader(y); reader(z); }
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w) { reader(x); reader(y); reader(z); reader(w); }

void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(ll x, char c) { int s = 0, m = 0; char f[20]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(double x, char c) { printf("%.10f", x); mypc(c); }
void writer(const char c[]) { int i; for (i = 0; c[i] != '\0'; i++)mypc(c[i]); }
void writer(const char x[], char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }

double mypow(double x, int y) {
    double res = 1;
    for (int i = 0; i < y; i++) {
        res *= x;
    }
    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 < 64; ++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;
    for (int i = 0; i < m; i++) {
        int a, b;
        double t;
        reader(&a, &b, &t);
        writerLn(solve(a, b, t));
        // printf("%.10f\n", solve(a, b, t));
    }
}
0