結果

問題 No.456 Millions of Submits!
ユーザー kyuridenamidakyuridenamida
提出日時 2016-12-08 04:01:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,157 ms / 4,500 ms
コード長 761 bytes
コンパイル時間 1,612 ms
コンパイル使用メモリ 144,680 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 11:54:17
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 f(double x){
	return a * x + b * log(x) - log(t);
}
double fd(double x){
	return a + b / x;
}


double initv = 0.0001;
double solve(){
	if( b == 0 ){
		return pow(t,(double)1./a);
	}
	double x = initv;
	for(int i = 0 ; i < 16 ; i++){ 
		x = x - f(x) / fd(x);

	}
	return exp(x);
}





int main(){
	int n;
	cin >> n;
	for(int i = 0 ; i < n ; i++){
		
		scanf("%Lf%Lf%Lf",&a,&b,&t);
		Double ans;
		while(1){
			ans = (Double)solve();
			if( isnan((double)ans)){
				initv = (rand() % 10000+1)/1000.;
			}else break;
		}

		printf("%.12lf\n",ans);
		//cout << solve(a,b,t) << endl;
	}
}
0