結果

問題 No.450 ベー君のシャトルラン
ユーザー ヒッキープログラミングするスレ GitHub ガチ
提出日時 2016-12-02 01:15:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 70,708 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-27 16:54:53
合計ジャッジ時間 1,425 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    long double vl, vr, d, w, ans = 0;
    cin >> vl >> vr >> d >> w;
    int i = 0;
    while (d > 0.000001 && i < 100000-00) {
        long double t1 = d / (w + vr);
        ans += w * t1;
        d -= (vl + vr) * t1;
        long double t2 = d / (w + vl);
        ans += w * t2;
        d -= (vl + vr) * t2;
        i++;
    }
    
    cout << fixed << setprecision(9) << ans << endl;
    
    return 0;
}
0