結果

問題 No.456 Millions of Submits!
ユーザー kyuridenamidakyuridenamida
提出日時 2016-12-08 03:49:08
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,394 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 144,360 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 11:40:27
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,380 KB
testcase_05 RE -
testcase_06 AC 2 ms
4,376 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

// もちろん落ちるけど
#include <bits/stdc++.h>
using namespace std;
typedef double Double;
#define double long double
const double EPS = 1e-12;

double a,b,t;


double mylog(double x){
	return log(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){
	return exp(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 = 0.0001;
	for(int i = 0 ; i < 25 ; 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);
		Double ans = (Double)myexp(solve());
		assert(!isnan(ans));
		printf("%.12lf\n",ans);
		//cout << solve(a,b,t) << endl;
	}
}
0