結果

問題 No.456 Millions of Submits!
ユーザー どららどらら
提出日時 2016-12-09 01:11:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,524 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 21:20:58
合計ジャッジ時間 7,401 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

//http://www.geocities.jp/midarekazu/cos.html
#define LOG2   0.693147180559945309417  //log(2)
double log_fast(double x)
{
    static double table[17]={
        .0                       ,  // log( 16 /16)
        .0606246218164348425806  ,  // log( 17 /16)
        .1177830356563834545387  ,  // log( 18 /16)
        .17185025692665922234    ,  // log( 19 /16)
        .2231435513142097557662  ,  // log( 20 /16)
        .2719337154836417588316  ,  // log( 21 /16)
        .3184537311185346158102  ,  // log( 22 /16)
        .3629054936893684531378  ,  // log( 23 /16)
        .405465108108164381978   ,  // log( 24 /16)
        .4462871026284195115325  ,  // log( 25 /16)
        .4855078157817008078017  ,  // log( 26 /16)
        .5232481437645478365168  ,  // log( 27 /16)
        .5596157879354226862708  ,  // log( 28 /16)
        .5947071077466927895143  ,  // log( 29 /16)
        .6286086594223741377443  ,  // log( 30 /16)
        .6613984822453650082602  ,  // log( 31 /16)
        .6931471805599453094172  ,  // log( 32 /16)
    };   
    unsigned long long w,kasuu16;
    int q;
    double y,h,z;
    w=*(unsigned long long*)&x;
    q=(((int)(w>>47)&0x1F)+1)>>1;
    kasuu16=(w & 0xFFFFFFFFFFFFFULL)^0x4030000000000000ULL;//仮数*16  16<=kasuu16<32 
    h=*(double*)&kasuu16;
    z=(double)(q+16);
    h=(h-z)/(h+z);
    z=h*h;
    y=(2.0/9)*z+2.0/7;
    y=y*z+2.0/5;
    y=y*z+2.0/3;
    y=y*z+2.0;
    y=y*h;
    return ((int)(w>>52)-1023)*LOG2+table[q]+y;
}
#undef LOG2

int main(){
  int m;
  cin >> m;
  rep(i,m){
    int a, b;
    double t;
    cin >> a >> b >> t;

    if(a==0){
      printf("%.12lf\n", exp(pow(t,1.0/b)));
    }
    else if(b==0){
      printf("%.12lf\n", pow(t,1.0/a));
    }
    else{
      double lb=0,ub=50;
      double logt = log(t);
      double y = a / b * pow(t,1.0/b);
      rep(j,50){
        double mid = (lb+ub)/2.0;
        if(mid * log_fast(mid) < y) lb = mid;
        else ub = mid;
      }
      printf("%.12lf\n", pow(lb,b/a));
    }
  }
  
  return 0;
}

0