結果
| 問題 |
No.57 ミリオンダイス
|
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2024-10-10 22:05:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 5,000 ms |
| コード長 | 1,275 bytes |
| コンパイル時間 | 1,044 ms |
| コンパイル使用メモリ | 105,728 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-10-10 22:05:34 |
| 合計ジャッジ時間 | 1,975 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
コンパイルメッセージ
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;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("1");
//3.5
//期待値は(出る目の合計)×(確率)の和で計算されます。
//よって、1*1/6+2*1/6+3*1/6+4*1/6+5*1/6+6*1/6=3.5が答えです。
}
else if (InputPattern == "Input2") {
WillReturn.Add("2");
//7
//2*(1/36)+3*(1/18)+4*(1/12)+5*(1/9)+6*(5/36)+
//7*(1/6)+8*(5/36)+9*(1/9)+10*(1/12)+11*(1/18)+12*(1/36)=7
}
else if (InputPattern == "Input3") {
WillReturn.Add("950832");
//3327912
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
decimal N = decimal.Parse(InputList[0]);
decimal E = (decimal)(Enumerable.Range(1, 6).Sum()) / 6;
//期待値の加法定理
Console.WriteLine(N * E);
}
}
aketijyuuzou