結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2016-12-09 01:11:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,524 bytes |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 80,796 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 16:42:15 |
| 合計ジャッジ時間 | 7,263 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 12 |
コンパイルメッセージ
main.cpp: In function ‘double log_fast(double)’:
main.cpp:52:6: warning: ‘kasuu16’ is used uninitialized [-Wuninitialized]
52 | h=*(double*)&kasuu16;
| ~^~~~~~~~~~~~~~~~~~~
main.cpp:46:26: note: ‘kasuu16’ declared here
46 | unsigned long long w,kasuu16;
| ^~~~~~~
ソースコード
#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;
}
どらら