結果

問題 No.456 Millions of Submits!
ユーザー Hoi_koroHoi_koro
提出日時 2016-12-12 23:21:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,832 ms / 4,500 ms
コード長 2,234 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 112,056 KB
実行使用メモリ 4,932 KB
最終ジャッジ日時 2023-09-05 22:32:36
合計ジャッジ時間 21,407 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 651 ms
4,872 KB
testcase_01 AC 649 ms
4,780 KB
testcase_02 AC 653 ms
4,552 KB
testcase_03 AC 646 ms
4,932 KB
testcase_04 AC 649 ms
4,688 KB
testcase_05 AC 648 ms
4,712 KB
testcase_06 AC 647 ms
4,568 KB
testcase_07 AC 653 ms
4,720 KB
testcase_08 AC 653 ms
4,620 KB
testcase_09 AC 683 ms
4,696 KB
testcase_10 AC 682 ms
4,708 KB
testcase_11 AC 967 ms
4,932 KB
testcase_12 AC 3,832 ms
4,692 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][1002];
    FOR(i,1,11)FOR(j,1,11)FOR(k,10,1002){
        pre[i][j][k]=solve(i,j,k*0.01);
    }
    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)*100);
        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