結果

問題 No.456 Millions of Submits!
コンテスト
ユーザー Yamyuki
提出日時 2016-12-08 14:39:09
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,178 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 296 ms
コンパイル使用メモリ 28,960 KB
最終ジャッジ日時 2026-02-23 23:28:27
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:46:17: error: C++ style comments are not allowed in ISO C90
   46 |                 //c=0;
      |                 ^
main.c:46:17: note: (this will be reported only once per input file)

ソースコード

diff #
raw source code

#include<stdio.h>
#include<math.h>

int a,b;
double time;

double beki(double x,int n){
	if(n==0) return 1;
	return x*beki(x,n-1);
}

double result(double x){
	return time-beki(x,a)*beki(log(x),b);
}

double newresult(double x){
	return (x*log(x)-time)/((double)a*log(x)+(double)b);
}


int main(){
	int c;
	long m,i;
	double s,e,dif;
	scanf("%ld",&m);
	for(i=0;i<m;i++){
		scanf("%d %d %lf",&a,&b,&time);
		if(a==0){
			printf("%.10f\n",pow(2.718281828459,pow(time,1.0/(double)b)));
		}else if(b==0){
			printf("%.10f\n",pow(time,1.0/(double)a));
		}else{/*
			s=1.0;
		e=22027.0;
		dif=result((s+e)/2.0);
		while(dif>0.0000000008 || dif<-0.0000000008){
			if(dif>0){
				s=(s+e)/2.0;
			}else{
				e=(s+e)/2.0;
			}
			dif=result((s+e)/2.0);
		}
		printf("%.10f\n",(s+e)/2.0);
		*/
		//c=0;
		e=22027.0;
		dif=result(e);
		c=0;
		while(c<5){
			e-=newresult(e);
			dif=newresult(e);
			c++;
		}
		s=1;
		dif=result((s+e)/2.0);
		while(dif>0.0000000008 || dif<-0.0000000008){
			if(dif>0){
				s=(s+e)/2.0;
			}else{
				e=(s+e)/2.0;
			}
			//printf("%f %.10f %.10f\n",dif,s,e);
			dif=result((s+e)/2.0);
			//c++;
		}
		printf("%.10f\n",(s+e)/2.0);
		
		
		}
	}
	return 0;
}
0