結果

問題 No.450 ベー君のシャトルラン
ユーザー kurenai3110
提出日時 2016-12-01 00:22:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 411 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 62,168 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-11-27 14:31:40
合計ジャッジ時間 16,550 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	double vl, vr, d, w; cin >> vl >> vr >> d >> w;

	double dist = 0;

	double l = 0, r = d;
	while (l < r - 0.00000001) {
		double cnt;
		if (w > 0) cnt = (r - l) / (w + vr);
		else cnt = (r - l) / (vl - w);
		dist += cnt*abs(w);
		l += cnt*vl;
		r -= cnt*vr;
		w = -w;
	}

	cout << fixed << setprecision(8) << dist << endl;

	return 0;
}
0