結果

問題 No.456 Millions of Submits!
ユーザー Hoi_koroHoi_koro
提出日時 2016-12-12 23:20:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4,381 ms / 4,500 ms
コード長 2,235 bytes
コンパイル時間 947 ms
コンパイル使用メモリ 111,608 KB
実行使用メモリ 5,640 KB
最終ジャッジ日時 2023-09-05 22:00:45
合計ジャッジ時間 30,339 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,303 ms
5,512 KB
testcase_01 AC 1,307 ms
5,540 KB
testcase_02 AC 1,304 ms
5,480 KB
testcase_03 AC 1,302 ms
5,516 KB
testcase_04 AC 1,303 ms
5,468 KB
testcase_05 AC 1,303 ms
5,420 KB
testcase_06 AC 1,305 ms
5,532 KB
testcase_07 AC 1,306 ms
5,456 KB
testcase_08 AC 1,307 ms
5,512 KB
testcase_09 AC 1,337 ms
5,640 KB
testcase_10 AC 1,336 ms
5,380 KB
testcase_11 AC 1,615 ms
5,420 KB
testcase_12 AC 4,381 ms
5,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define dump(a) cout<<#a <<' '<< a <<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;
double eps=1e-13;
double solve(int a, int b, double t){
    double l=0.1,u=22222.0;
    while(u-l>5e-10){
        double m=(l+u)/2.0;
        if(pow(m,(double)a)*pow(log(m),(double)b)<t-eps){
            l=m;
        }else{
            u=m;
        }
    }
    return (l+u)/2.0;
}

int main(){
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    cout << fixed << setprecision(11);
    double pre[11][11][2002];
    FOR(i,1,11)FOR(j,1,11)FOR(k,10,2002){
        pre[i][j][k]=solve(i,j,k*0.005);
    }
    int m,a,b,pt;
    cin >> m;
    double t,l,u,mid,tmp,tmp2;
    REP(i,m){
        scanf("%d %d %lf",&a,&b,&t);
        pt=floor((t+0.00005)*200);
        l=pre[a][b][pt],u=pre[a][b][pt+1];
        //l=0.1;u=22222.0;
        if(a==0){
            printf("%.11lf\n",exp(pow(t,1.0/b)));
            continue;
        }
        if(b==0){
            printf("%.11lf\n",pow(t,1.0/a));
            continue;
        }
        while(u-l>5e-10){
            mid=(l+u)/2.0;
            if(a==b)tmp=pow(mid*log(mid),b);
            else tmp=pow(mid,a)*pow(log(mid),b);
            if(tmp<t-eps){
                l=mid;
            }else{
                u=mid;
            }
        }
        printf("%.11lf\n",(l+u)/2.0);
    }

    return 0;
}
0