結果

問題 No.450 ベー君のシャトルラン
ユーザー mono1977
提出日時 2016-12-01 03:17:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 358 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 13,768 KB
最終ジャッジ日時 2024-11-27 15:09:30
合計ジャッジ時間 7,424 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%lf %lf %lf %lf",&v1,&v2,&d,&w);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int main(){
	double v1,v2,d,w;
	scanf("%lf %lf %lf %lf",&v1,&v2,&d,&w);
	
	double total=0;
	
	while(d>0.0000001){
			total+=w*d/(w+v2);//蜂が右の車にぶつかるまでの距離
			d-=(v1+v2)*d/(w+v2);//左右の車が動いた距離を減らす
			total+=w*d/(w+v1);
			d-=(v1+v2)*d/(w+v1);
	}
	
	printf("%f\n",total);
	
	return 0;
}
0