結果
| 問題 |
No.567 コンプリート
|
| コンテスト | |
| ユーザー |
明智重蔵
|
| 提出日時 | 2017-09-11 19:42:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 363 ms / 2,000 ms |
| コード長 | 1,910 bytes |
| コンパイル時間 | 1,031 ms |
| コンパイル使用メモリ | 110,392 KB |
| 実行使用メモリ | 31,040 KB |
| 最終ジャッジ日時 | 2024-12-14 15:52:00 |
| 合計ジャッジ時間 | 2,467 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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
//1回投げて全部揃うことはありません
}
else if (InputPattern == "Input2") {
WillReturn.Add("6");
//0.015432098765432
//(1/6)の6乗 * 6の階乗
}
else if (InputPattern == "Input3") {
WillReturn.Add("7");
//0.054012345
}
else if (InputPattern == "Input4") {
WillReturn.Add("50");
//0.99934071
//このくらいになるとほぼ確実に全て出ますね
}
else if (InputPattern == "Input5") {
WillReturn.Add("1000000");
}
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表
double[] PrevDP = new double[7];
PrevDP[0] = 1D;
for (int I = 1; I <= N; I++) {
double[] CurrDP = new double[7];
for (int J = 0; J <= 6; J++) {
//登場した目の数が増えない確率
double HuenaiP = J / 6D;
CurrDP[J] += PrevDP[J] * HuenaiP;
//登場した目の数が1増える確率
double HueruP = 1D - HuenaiP;
if (J <= 5) {
CurrDP[J + 1] += PrevDP[J] * HueruP;
}
}
PrevDP = CurrDP;
}
Console.WriteLine(PrevDP[6]);
}
}
明智重蔵