結果

問題 No.58 イカサマなサイコロ
ユーザー mbanmban
提出日時 2017-01-05 14:26:05
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,350 bytes
コンパイル時間 3,856 ms
コンパイル使用メモリ 102,856 KB
実行使用メモリ 27,816 KB
最終ジャッジ日時 2023-08-22 12:25:28
合計ジャッジ時間 10,827 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4,406 ms
21,712 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 62 ms
21,336 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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];
    static void Main()
    {
        N = int.Parse(Console.ReadLine());
        K = int.Parse(Console.ReadLine());
        calc();
        long cnt = 0;
        for(int i = 1; i < 60; i++)
        {
            for(int j = i + 1; j <= 60; j++)
            {
                cnt += Tcnt[j] * Zcnt[i];
            }
        }
        Console.WriteLine((double)cnt / (Tcnt.Sum() * Zcnt.Sum()));
    }
    static void calc()
    {
        int loop =(int) Math.Pow(6, N);
        for(int i = 0; i < loop; i++)
        {
            int c = i;
            int T=0, Z = 0;
            for(int j = 0; j < N; j++)
            {
                int d = c % 6;
                if (d == 0)
                {
                    d = 6;
                }
                Z += d;
                if (K - 1 > j)
                {
                    T += (3 + (d + 1) / 2);
                }
                else
                {
                    T += d;
                }
                c /= 6;
            }
            Tcnt[T]++;
            Zcnt[Z]++;
        }
    }
}
0