結果

問題 No.58 イカサマなサイコロ
ユーザー NoNo
提出日時 2015-06-07 22:50:13
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,132 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 104,116 KB
実行使用メモリ 24,924 KB
最終ジャッジ日時 2023-09-20 19:42:47
合計ジャッジ時間 5,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
22,884 KB
testcase_01 AC 506 ms
22,792 KB
testcase_02 AC 155 ms
24,824 KB
testcase_03 AC 114 ms
22,776 KB
testcase_04 AC 338 ms
22,832 KB
testcase_05 AC 385 ms
24,924 KB
testcase_06 AC 469 ms
22,976 KB
testcase_07 AC 157 ms
20,812 KB
testcase_08 WA -
testcase_09 AC 463 ms
22,916 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 < 1000000; 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 / 1000000;

            Console.WriteLine(ans);
        }
    }
}
0