結果

問題 No.58 イカサマなサイコロ
ユーザー mbanmban
提出日時 2017-01-05 16:35:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 976 ms / 5,000 ms
コード長 1,041 bytes
コンパイル時間 3,374 ms
コンパイル使用メモリ 105,264 KB
実行使用メモリ 24,796 KB
最終ジャッジ日時 2023-08-22 12:52:06
合計ジャッジ時間 9,750 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 254 ms
22,736 KB
testcase_01 AC 976 ms
24,796 KB
testcase_02 AC 254 ms
22,744 KB
testcase_03 AC 165 ms
22,860 KB
testcase_04 AC 622 ms
22,696 KB
testcase_05 AC 725 ms
22,688 KB
testcase_06 AC 894 ms
22,864 KB
testcase_07 AC 255 ms
22,840 KB
testcase_08 AC 438 ms
24,712 KB
testcase_09 AC 883 ms
22,708 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 N, K;
    static long[] Tcnt = new long[61], Zcnt = new long[61];
    const int MAX = 2000000;
    static void Main()
    {
        N = int.Parse(Console.ReadLine());
        K = int.Parse(Console.ReadLine());
        int cnt = 0;
        Random rnd = new Random();
        for(int i = 0; i < MAX; i++)
        {
            int taro = 0, ziro = 0;
            for(int j = 0; j < N; j++)
            {
                ziro += rnd.Next(1, 6+1);
                if (j <= K - 1)
                {
                    taro += rnd.Next(4, 6+1);
                }
                else
                {
                    taro += rnd.Next(1, 6+1);
                }
            }
            if (taro > ziro)
            {
                cnt++;
            }
        }
        Console.WriteLine((double)cnt / MAX);
    }

}
0