結果

問題 No.57 ミリオンダイス
ユーザー 明智重蔵明智重蔵
提出日時 2015-08-03 21:06:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 1,274 bytes
コンパイル時間 2,780 ms
コンパイル使用メモリ 103,856 KB
実行使用メモリ 23,832 KB
最終ジャッジ日時 2023-08-09 00:38:24
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,764 KB
testcase_01 AC 63 ms
21,828 KB
testcase_02 AC 63 ms
23,804 KB
testcase_03 AC 63 ms
21,700 KB
testcase_04 AC 64 ms
21,864 KB
testcase_05 AC 63 ms
23,832 KB
testcase_06 AC 63 ms
23,812 KB
testcase_07 AC 63 ms
21,808 KB
testcase_08 AC 64 ms
21,904 KB
testcase_09 AC 63 ms
21,700 KB
testcase_10 AC 63 ms
21,864 KB
testcase_11 AC 64 ms
23,816 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