結果

問題 No.65 回数の期待値の練習
ユーザー mbanmban
提出日時 2017-01-05 16:47:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 367 ms / 5,000 ms
コード長 665 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 104,364 KB
実行使用メモリ 24,872 KB
最終ジャッジ日時 2023-08-22 12:52:43
合計ジャッジ時間 8,130 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
24,724 KB
testcase_01 AC 123 ms
22,644 KB
testcase_02 AC 137 ms
22,888 KB
testcase_03 AC 191 ms
24,756 KB
testcase_04 AC 146 ms
24,816 KB
testcase_05 AC 160 ms
22,768 KB
testcase_06 AC 176 ms
22,784 KB
testcase_07 AC 207 ms
24,812 KB
testcase_08 AC 220 ms
24,772 KB
testcase_09 AC 229 ms
24,744 KB
testcase_10 AC 244 ms
22,836 KB
testcase_11 AC 262 ms
24,708 KB
testcase_12 AC 270 ms
22,700 KB
testcase_13 AC 283 ms
22,896 KB
testcase_14 AC 299 ms
22,708 KB
testcase_15 AC 312 ms
22,772 KB
testcase_16 AC 325 ms
22,784 KB
testcase_17 AC 340 ms
22,920 KB
testcase_18 AC 357 ms
22,796 KB
testcase_19 AC 367 ms
24,872 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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static int K = int.Parse(Console.ReadLine());
    static int cnt = 0;
    const int MAX = 2000000;
    static void Main()
    {
        Random rnd = new Random();
        for(int i = 0; i < MAX; i++)
        {
            int a = 0;
            int l = 0;
            while (a < K)
            {
                a += rnd.Next(1, 7);
                l++;
            }
            cnt += l;
        }
        Console.WriteLine((double)cnt / MAX);
    }

}
0