結果

問題 No.456 Millions of Submits!
ユーザー rickythetarickytheta
提出日時 2016-12-07 23:31:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,655 ms / 4,500 ms
コード長 1,721 bytes
コンパイル時間 3,094 ms
コンパイル使用メモリ 143,776 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 07:45:56
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

inline void solve(/*double a,double b,double t*/){
  double a,b,t;
  scanf("%lf%lf%lf",&a,&b,&t);
  if(a==0){
    // ln(x)^b = t
    t = pow(t,1.0/b);
    printf("%.12f\n",exp(t));
  }else if(b==0){
    // x^a = t;
    printf("%.12f\n",pow(t,1.0/a));
  }else{
    double dt = t;
    t = log(t);
    double lo=0.0, hi=12.0;
    REP(_,50){
      double mid = (lo+hi)/2.0;
      double tt = a*mid + b*log(mid);
      if(tt<t)lo = mid;
      else hi = mid;
    }
    printf("%.12f\n",exp(lo));
    // checker
    // double ans = exp(lo);
    // double check = pow(ans,a) * pow(log(ans),b);
    // if(abs(check - dt) > EPS){
    //   printf("%f,%f,%f -> %f,%f\n",a,b,t,ans,check);
    // }
  }
}

int main(){
  int m;
  scanf("%d",&m);
  while(m--)solve();
  // FOR(a,1,11)FOR(b,1,11){
  //   for(double t = 0.1; t <= 10.0; t += 0.001){
  //     solve(a,b,t);
  //   }
  // }
  return 0;
}
0