結果

問題 No.450 ベー君のシャトルラン
ユーザー 14番14番
提出日時 2016-12-19 13:45:44
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
実行時間 -
コード長 1,893 bytes
コンパイル時間 3,627 ms
コンパイル使用メモリ 105,716 KB
実行使用メモリ 814,396 KB
最終ジャッジ日時 2023-08-21 01:13:47
合計ジャッジ時間 9,306 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
22,060 KB
testcase_01 AC 68 ms
21,900 KB
testcase_02 AC 71 ms
21,844 KB
testcase_03 AC 70 ms
22,084 KB
testcase_04 AC 70 ms
19,800 KB
testcase_05 AC 69 ms
22,004 KB
testcase_06 AC 69 ms
24,060 KB
testcase_07 AC 70 ms
22,016 KB
testcase_08 AC 72 ms
22,068 KB
testcase_09 AC 71 ms
21,952 KB
testcase_10 AC 69 ms
21,880 KB
testcase_11 AC 71 ms
22,000 KB
testcase_12 AC 71 ms
24,104 KB
testcase_13 AC 70 ms
22,096 KB
testcase_14 AC 69 ms
21,852 KB
testcase_15 AC 69 ms
21,948 KB
testcase_16 AC 70 ms
21,964 KB
testcase_17 AC 69 ms
22,080 KB
testcase_18 AC 69 ms
21,956 KB
testcase_19 AC 69 ms
19,900 KB
testcase_20 AC 70 ms
22,028 KB
testcase_21 MLE -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        decimal[] inpt = Reader.ReadLine().Split(' ').Select(a=>decimal.Parse(a)).ToArray();
        this.V1 = inpt[0];
        this.V2 = inpt[1];
        this.D = decimal.Parse(Reader.ReadLine());
        this.W = decimal.Parse(Reader.ReadLine());
        decimal ans = Math.Round(GetAns(0, D, true), 7);
        Console.WriteLine(ans);
    }

    private decimal GetAns(decimal v1Pos, decimal v2Pos, bool isLeft) {
        decimal diff = v2Pos - v1Pos;
        if(diff < 0.000000001m) {
            return diff;
        }
        decimal pos = 0;
        
        if(isLeft) {
            pos = diff / (V2 + W) * W;
            decimal nextV1 = pos / W * V1;
            decimal nextV2 = pos;
            return GetAns(nextV1, nextV2, !isLeft) + pos;
        } else {
            decimal mv = (diff / (V1 + W) * W);
            decimal nextV1 = v2Pos - mv;
            decimal nextV2 = v2Pos - (mv / W * V2);
            return GetAns(nextV1, nextV2, !isLeft) + mv;
        }
    }

    private decimal V1;
    private decimal V2;

    private decimal D;
    private decimal W;


    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


90 568
5019
870




";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }

    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0