結果

問題 No.456 Millions of Submits!
ユーザー はむこ
提出日時 2016-12-06 10:27:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,584 ms / 4,500 ms
コード長 775 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 159,980 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 02:08:14
合計ジャッジ時間 8,610 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &m);
      |     ~~~~~^~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d%d%lf", &a, &b, &t);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main() {
    int m;
    scanf("%d", &m);
    double e = exp(1);
    double eps = 1e-10 * 2;
    while(m--) {
        int a, b;
        double t, l, r, n;
        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 tt = pow(t, 1.0 / b) * a / b;
        l = 0;
        r = max(10.0, tt);
        while (r - l > eps) {
            n = (l + r) / 2;
            if (n * log(n) > tt)
                r = n;
            else
                l = n;
        }
        printf("%.12f\n", pow((l + r) / 2, 1.0 * b / a));
    }
    return 0;
}
0