結果

問題 No.456 Millions of Submits!
ユーザー はむこ
提出日時 2016-12-06 10:27:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,740 ms / 4,500 ms
コード長 568 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 157,820 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 02:09:37
合計ジャッジ時間 9,576 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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) * a / b;
        double l = 0, r = 100, p;

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