結果

問題 No.450 ベー君のシャトルラン
ユーザー autumn-eel
提出日時 2016-12-02 22:46:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 1,254 ms
コンパイル使用メモリ 158,492 KB
実行使用メモリ 13,768 KB
最終ジャッジ日時 2024-11-27 17:45:54
合計ジャッジ時間 8,075 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 18 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:21: warning: format ‘%lf’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat=]
   19 |         printf("%.7lf\n", ans);
      |                 ~~~~^     ~~~
      |                     |     |
      |                     |     long double
      |                     double
      |                 %.7Lf

ソースコード

diff #

#include<bits/stdc++.h>
#define double long double
#define EPS (1e-6)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	double vl, vr, d, w; cin >> vl >> vr >> d >> w;
	bool b = true;
	double ans = 0;
	while (d > EPS) {
		double t;
		if (b)t = d / (vr + w);
		else t = d / (vl + w);
		ans += t*w;
		d -= t*(vl + vr);
		b = !b;
	}
	printf("%.7lf\n", ans);
}
0