結果
| 問題 | 
                            No.456 Millions of Submits!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kyuridenamida
                         | 
                    
| 提出日時 | 2016-12-08 03:36:02 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,314 bytes | 
| コンパイル時間 | 1,499 ms | 
| コンパイル使用メモリ | 159,456 KB | 
| 実行使用メモリ | 8,704 KB | 
| 最終ジャッジ日時 | 2024-06-23 07:11:53 | 
| 合計ジャッジ時間 | 10,029 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 WA * 11 TLE * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:77:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   77 |                 scanf("%Lf%Lf%Lf",&a,&b,&t);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
// もちろん落ちるけど
#include <bits/stdc++.h>
using namespace std;
typedef double Double;
#define double long double
const double EPS = 1e-15;
double a,b,t;
double mylog(double x){
	double i=1;   // (i.e. not 3)
	double logx = 0 ;
	double ty = (x-1)/(x+1),tty;
	do
	{
	    logx = logx + ty / i;
	    tty = ty ;
	    ty = (ty * ((x-1)/(x+1)) * ((x-1)/(x+1)));
	    i = i + 2 ;
	} while(tty - ty > EPS );
	return 2 * logx;
}
const double e = 2.718281828459045235360287471352662497757247093699;
double myexp(double x){
	int intp = (int)x;
	double realp = x - intp;
	double ans1 = 1;
	for(int i = 0 ; i < intp ; i++){
		ans1 *= e;
	}
	
	double ans2 = 0;
	double den = 1;
	double num = 1;
	double f = 1;
	for(int i = 1 ; i <= 20 ; i++){
		ans2 += num / den;
		den *= i;
		num *= realp;
	}
	return ans1 * ans2;
}
double f(double m){
	return a * m + b * mylog(m) - mylog(t);
}
double fd(double x){
	return a + b / x;
}
double solve(){
	double x = 1;
	for(int i = 0 ; i < 16 ; i++){ 
		x = x - f(x) / fd(x);
	}
	return x;
}
int main(){
	//cout << mylog(10) << " " << mylog(e*e) << endl;
	//printf("%.16lf\n",(Double)myexp(1.9));
	int n;
	cin >> n;
	for(int i = 0 ; i < n ; i++){
		
		scanf("%Lf%Lf%Lf",&a,&b,&t);
		printf("%.12lf\n",(Double)myexp(solve()));
		//cout << solve(a,b,t) << endl;
	}
}
            
            
            
        
            
kyuridenamida