結果

問題 No.162 8020運動
ユーザー syoken_desukasyoken_desuka
提出日時 2015-03-06 00:05:17
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 4,978 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 112,432 KB
実行使用メモリ 29,096 KB
最終ジャッジ日時 2024-06-24 09:41:40
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
24,976 KB
testcase_01 AC 27 ms
26,880 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 26 ms
25,108 KB
testcase_10 AC 27 ms
25,136 KB
testcase_11 AC 26 ms
23,968 KB
testcase_12 AC 26 ms
26,152 KB
testcase_13 AC 26 ms
24,084 KB
testcase_14 AC 27 ms
23,948 KB
testcase_15 AC 28 ms
22,836 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 28 ms
27,184 KB
testcase_19 WA -
testcase_20 AC 27 ms
24,880 KB
testcase_21 AC 27 ms
24,720 KB
testcase_22 AC 26 ms
24,336 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 26 ms
24,720 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

#region ZIPPER
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Numerics;
using sc = Scanner;
class Program
{
    static void Main(string[] args)
    {
        Solver solver = new Solver();
        solver.Solve();
#if DEBUG
        System.Console.WriteLine("続行するには何かキーを押してください...");
        System.Console.ReadKey();
#endif

    }
}
/// <summary>
/// Java風のスキャナー,自作(某最速の人を参考)
/// </summary>
public static class Scanner
{
    public static string NextString()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return tmp;
    }
    public static int NextInt()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return int.Parse(tmp);
    }
    public static long NextLong()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return long.Parse(tmp);
    }
    public static double NextDouble()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return double.Parse(tmp);
    }

    public static string[] NextStrArray()
    {
        return Console.ReadLine().Split(' ');
    }
    public static int[] NextIntArray()
    {

        string[] s = NextStrArray();
        int[] a = new int[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = int.Parse(s[i]);
        }
        return a;
    }
    public static long[] NextLongArray()
    {
        string[] s = NextStrArray();
        long[] a = new long[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = long.Parse(s[i]);
        }
        return a;
    }
    public static double[] NextDoubleArray()
    {
        string[] s = NextStrArray();
        double[] a = new double[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = double.Parse(s[i]);
        }
        return a;
    }
}
#endregion ZIPPER

public class Solver
{
#region IGNORE_ME
    public Solver()
    {
        //こんすとらくたん きにしなくてよろしい
    }
#endregion IGNORE_ME

#region FIELD

#endregion FIELD

    public void Solve()
    {
        int a = sc.NextInt();
        double[] p = new double[3];
        for (int i = 0; i < 3; i++)
        {
            p[i] = 1.0 * sc.NextInt() / 100;
        }
        double[,] dp = new double[81, 14];
        for (int i = 0; i < 14; i++)
        {
            dp[a, i] = 1;
        }
        for (int i = a; i < 80; i++)
        {
            for (int j = 1; j < 13; j++)
            {
                double ryosidenon = (1.0-dp[i,j-1])*(1.0-dp[i,j+1]);
                double ryosideari = dp[i,j-1]*dp[i,j+1];
                dp[i + 1, j] =
                    dp[i,j]
                    *(
                    ryosideari * (1-p[2])
                    + ryosidenon * (1-p[0])
                    + (1 - ryosideari - ryosidenon) *(1- p[1])
                    );
#if DEBUG
                Console.WriteLine("{0} {1} {2}",ryosideari,ryosidenon,1.0-ryosideari-ryosidenon);
#endif 
            }
            dp[i + 1, 0] = dp[i,0]*(dp[i, 1] * (1 - p[1]) + (1 - dp[i, 1]) * (1 - p[0]));
            dp[i + 1, 13] = dp[i,13]*(dp[i , 12] * (1 - p[1]) + (1 - dp[i , 12]) * (1 - p[0]));

        }
        double answer = 0;
        for (int i = 0; i < 14; i++)
        {
            answer += 2* dp[80, i];
        }
        Console.WriteLine(answer);
#if DEBUG
        Console.WriteLine("");//local check
#endif
    }

}
0