結果

問題 No.456 Millions of Submits!
ユーザー はむこはむこ
提出日時 2016-12-06 11:40:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,519 ms / 4,500 ms
コード長 575 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 158,056 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 02:16:47
合計ジャッジ時間 10,336 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 26 ms
5,376 KB
testcase_10 AC 26 ms
5,376 KB
testcase_11 AC 250 ms
5,376 KB
testcase_12 AC 2,519 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     int m; scanf("%d", &m);
      |            ~~~~~^~~~~~~~~~
main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         int a, b; double t; scanf("%d%d%lf", &a, &b, &t);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main() {
    int m; scanf("%d", &m);
    while(m--) {
        int a, b; double t; scanf("%d%d%lf", &a, &b, &t);
        if (!b) { printf("%.12f\n", pow(t, 1.0 / a)); continue; }
        if (!a) { printf("%.12f\n", exp(pow(t, 1.0 / b))); continue; }

        double q = pow(t, 1.0 / b);
        double l = 0, r = (t <= 1 ? 2.5 : 291), n;

        while (r - l > 1e-10) {
            n = (l + r) / 2;
            (pow(n, (double)a/b) * log(n) > q) ? r = n : l = n;
        }
        printf("%.12f\n", n);
    }
    return 0;
}
0