using System; using System.Collections.Generic; class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); 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 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]); } }