結果

問題 No.58 イカサマなサイコロ
ユーザー mban
提出日時 2017-01-05 16:35:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 872 ms / 5,000 ms
コード長 1,041 bytes
コンパイル時間 2,514 ms
コンパイル使用メモリ 103,680 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-12-16 10:00:17
合計ジャッジ時間 8,250 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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