結果

問題 No.57 ミリオンダイス
ユーザー 明智重蔵明智重蔵
提出日時 2015-08-03 21:06:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 1,274 bytes
コンパイル時間 3,551 ms
コンパイル使用メモリ 111,024 KB
実行使用メモリ 27,260 KB
最終ジャッジ日時 2024-04-26 16:37:06
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,892 KB
testcase_01 AC 28 ms
24,984 KB
testcase_02 AC 28 ms
25,100 KB
testcase_03 AC 28 ms
25,092 KB
testcase_04 AC 27 ms
25,016 KB
testcase_05 AC 27 ms
25,004 KB
testcase_06 AC 28 ms
24,704 KB
testcase_07 AC 29 ms
27,260 KB
testcase_08 AC 28 ms
24,964 KB
testcase_09 AC 27 ms
26,936 KB
testcase_10 AC 28 ms
27,064 KB
testcase_11 AC 28 ms
24,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
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);
    }
}
0