結果

問題 No.450 ベー君のシャトルラン
ユーザー butsurizukibutsurizuki
提出日時 2016-12-01 14:03:17
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 16:37:29
合計ジャッジ時間 2,656 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 0 ms
5,376 KB
testcase_12 AC 0 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 0 ms
5,376 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%lf%lf%lf%lf",&vl,&vr,&d,&w);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int main(void){
	double vl,vr,vlp,vrp,d,w,t,r=0,fm,c = 0;
	scanf("%lf%lf%lf%lf",&vl,&vr,&d,&w);
	vlp=0;vrp=d;
	t = (vrp-vlp)/(vr+w);
	fm=(t*w);
	while(1){
		t = (vrp-vlp)/(vr+w);
		r+=(t*w);
		vlp+=(t*vl);vrp-=(t*vr);
		if(t*w < fm * 0.0000001){break;}
		t = (vrp-vlp)/(vl+w);
		r+=(t*w);
		vlp+=(t*vl);vrp-=(t*vr);
		if(t*w < fm * 0.0000001){break;}
		c++;
		if(c > 50000000){break;}
	}
	if(c == 50000001){r = r*d*d/(d-vrp+vlp)/(d-vrp+vlp);}
	printf("%.12lf",r);
	return 0;
}
0