結果

問題 No.456 Millions of Submits!
ユーザー pekempeypekempey
提出日時 2016-12-08 22:41:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,409 bytes
コンパイル時間 3,525 ms
コンパイル使用メモリ 164,608 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 21:12:45
合計ジャッジ時間 9,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

bool dot;

int readInt() {
    int n, c;
    while ((c = getchar()) < '0');
    n = c - '0';
    while ((c = getchar()) >= '0') {
        n = n * 10 + c - '0';
    }
    dot = c == '.';
    return n;
}

void writeDouble(double x) {
    int a = x;
    int b = (x - a) * 1e9;
    int d[15];
    int i = 0;
    for (int j = 0; j < 9; j++) {
        d[i++] = b % 10 + '0';
        b /= 10;
    }
    d[i++] = '.';
    do {
        d[i++] = a % 10 + '0';
        a /= 10;
    } while (a > 0);
    while (i > 0) {
        putchar(d[--i]);
    }
    putchar('\n');
}

int main() {
    int m;
    cin >> m;
    while (m--) {
        int a = readInt();
        int b = readInt();
        int c = readInt();
        int d = dot ? readInt() : 0;
        double t = c + d * 1e-4;
        if (b == 0) {
            writeDouble(pow(t, 1.0 / a));
            continue;
        }
        if (a == 0) {
            writeDouble(exp(pow(t, 1.0 / b)));
            continue;
        }
        double r = 10;
        double l = 1;
        for (int ii = 0; ii < 40; ii++) {
            double mid = (l + r) / 2;
            if (pow(mid, a) * pow(log(mid), b) > t) {
                r = mid;
            } else {
                l = mid;
            }
        }
        writeDouble(r);
    }
}
0