結果

問題 No.456 Millions of Submits!
ユーザー imulanimulan
提出日時 2016-12-08 04:29:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,617 ms / 4,500 ms
コード長 1,966 bytes
コンパイル時間 1,477 ms
コンパイル使用メモリ 163,320 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 12:08:22
合計ジャッジ時間 10,651 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

inline double F(double x, int a, int b, double t)
{
    double pa=pow(x,a-1), pb=pow(log(x),b-1);

    double C = pa*x * pb*log(x) - t;
    double D = pa * pb * (a*log(x)+b);
    return C/D;
}

const double eps=1e-9;

double X[11][11] = {
    {},
    {0, 5.73, 4.47, 3.93, 3.63, 3.45, 3.33, 3.24, 3.18, 3.121, 3.081},
    {0, 3.012, 2.937, 2.892, 2.862, 2.841, 2.825, 2.813, 2.803, 2.795, 2.789},
    {0, 2.294, 2.375, 2.429, 2.469, 2.498, 2.522, 2.540, 2.556, 2.569, 2.580},
    {0, 1.963, 2.080, 2.163, 2.225, 2.275, 2.315, 2.348, 2.377, 2.401, 2.421},
    {0, 1.773, 1.896, 1.987, 2.059, 2.116, 2.164, 2.205, 2.240, 2.270, 2.296},
    {0, 1.649, 1.771, 1.863, 1.937, 1.997, 2.049, 2.093, 2.131, 2.165, 2.195},
    {0, 1.561, 1.678, 1.769, 1.843, 1.904, 1.957, 2.003, 2.043, 2.079, 2.111},
    {0, 1.496, 1.608, 1.696, 1.768, 1.829, 1.882, 1.929, 1.970, 2.006, 2.039},
    {0, 1.445, 1.552, 1.637, 1.707, 1.768, 1.820, 1.866, 1.907, 1.945, 1.978},
    {0, 1.404, 1.506, 1.588, 1.657, 1.716, 1.767, 1.813, 1.854, 1.891, 1.925,}
};


int main()
{
    int m;
    scanf(" %d", &m);
    while(m--)
    {
        int a,b;
        double t;
        scanf(" %d %d %lf", &a, &b, &t);

        double ans;
        if(a==0) ans = pow(exp(1), pow(t,1.0/b));
        else if(b==0) ans = pow(t,1.0/a);
        else
        {
            double x=X[a][b];
            double oldx=0;

            // int ct=0;
            while(fabs(x-oldx)>eps)
            {
                // ++ct;
                oldx = x;
                x = x - F(x,a,b,t);
            }

            // printf("ct=%d\n", ct);
            ans = x;
        }

        printf("%.10f\n", ans);
    }
    return 0;
}
0