結果
問題 | No.57 ミリオンダイス |
ユーザー | 明智重蔵 |
提出日時 | 2015-08-03 21:06:24 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 29 ms / 5,000 ms |
コード長 | 1,274 bytes |
コンパイル時間 | 2,075 ms |
コンパイル使用メモリ | 111,912 KB |
実行使用メモリ | 27,260 KB |
最終ジャッジ日時 | 2024-11-14 05:54:08 |
合計ジャッジ時間 | 3,219 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 = "Input4"; 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); } }