結果

問題 No.58 イカサマなサイコロ
ユーザー NoNo
提出日時 2015-06-07 22:53:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 4,512 ms / 5,000 ms
コード長 1,611 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 108,620 KB
実行使用メモリ 25,032 KB
最終ジャッジ日時 2023-09-20 19:43:38
合計ジャッジ時間 28,191 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,026 ms
22,880 KB
testcase_01 AC 4,512 ms
24,932 KB
testcase_02 AC 1,005 ms
22,916 KB
testcase_03 AC 585 ms
22,896 KB
testcase_04 AC 2,820 ms
22,900 KB
testcase_05 AC 3,293 ms
24,944 KB
testcase_06 AC 4,132 ms
24,932 KB
testcase_07 AC 1,040 ms
24,956 KB
testcase_08 AC 1,920 ms
24,944 KB
testcase_09 AC 4,082 ms
25,032 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;
using System.Text;
using System.Threading.Tasks;

namespace foryuki
{
    class Program
    {
        static void Main(string[] args)
        {
            Random r = new Random();

            int N = int.Parse(Console.ReadLine());
            int K = int.Parse(Console.ReadLine());

            //二郎
            double k1;

            //太郎
            double k2;

            double cnt = 0;
            for (int i = 0; i < 10000000; i++)
            {
                k1 = 0;
                k2 = 0;
                for (int j = 0; j < N; j++)
                {
                    k1 += r.Next(1, 7);
                    if (j < K)
                    {
                        k2 += r.Next(4, 7);
                    }
                    else
                    {
                        k2 += r.Next(1, 7);
                    }
                }
                if (k1 < k2)
                {
                    cnt++;
                }
            }

            double ans = cnt / 10000000;

            Console.WriteLine(ans);
        }




        //-------------------------------------------------------------

        static int[] ConvertStringArrayToIntArray(string[] str, int defaultValue)
        {
            int[] b = Array.ConvertAll<string, int>(str, delegate(string value)
                {
                    return int.Parse(value);
                });

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = defaultValue;
            }
            return b;
        }
    }
}
0