結果

問題 No.567 コンプリート
ユーザー 明智重蔵明智重蔵
提出日時 2017-09-09 15:31:40
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,643 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 105,472 KB
実行使用メモリ 30,296 KB
最終ジャッジ日時 2024-04-25 01:05:11
合計ジャッジ時間 5,383 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
18,048 KB
testcase_01 AC 27 ms
18,048 KB
testcase_02 AC 26 ms
17,920 KB
testcase_03 AC 25 ms
18,176 KB
testcase_04 AC 27 ms
18,048 KB
testcase_05 AC 27 ms
18,048 KB
testcase_06 AC 27 ms
17,920 KB
testcase_07 AC 26 ms
17,920 KB
testcase_08 AC 26 ms
18,304 KB
testcase_09 AC 26 ms
18,048 KB
testcase_10 AC 26 ms
17,920 KB
testcase_11 AC 26 ms
18,048 KB
testcase_12 AC 27 ms
18,048 KB
testcase_13 AC 26 ms
17,920 KB
testcase_14 AC 27 ms
18,048 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1");
            //0
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("6");
            //0.015432098765432
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("7");
            //0.054012345
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("50");
            //0.99934071
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int N = int.Parse(InputList[0]);

        //確率[登場した目の数]なDP表
        decimal[] PrevDP = new decimal[7];
        PrevDP[0] = 1M;

        for (int I = 1; I <= N; I++) {
            decimal[] CurrDP = new decimal[7];

            for (int J = 0; J <= 6; J++) {
                //登場した目の数が増えない確率
                decimal HuenaiP = J / 6M;
                CurrDP[J] += PrevDP[J] * HuenaiP;

                //登場した目の数が1増える確率
                decimal HueruP = 1M - HuenaiP;

                if (J <= 5) {
                    CurrDP[J + 1] += PrevDP[J] * HueruP;
                }
            }
            PrevDP = CurrDP;
        }
        Console.WriteLine(PrevDP[6]);
    }
}
0