結果

問題 No.162 8020運動
ユーザー syoken_desukasyoken_desuka
提出日時 2015-03-06 00:05:17
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 4,978 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 105,440 KB
実行使用メモリ 26,452 KB
最終ジャッジ日時 2023-09-06 15:17:31
合計ジャッジ時間 5,428 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
24,604 KB
testcase_01 AC 60 ms
22,440 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 61 ms
22,496 KB
testcase_10 AC 62 ms
22,684 KB
testcase_11 AC 57 ms
20,708 KB
testcase_12 AC 57 ms
22,732 KB
testcase_13 AC 57 ms
20,668 KB
testcase_14 AC 58 ms
22,660 KB
testcase_15 AC 60 ms
22,384 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 60 ms
22,552 KB
testcase_19 WA -
testcase_20 AC 60 ms
22,444 KB
testcase_21 AC 60 ms
22,496 KB
testcase_22 AC 60 ms
18,688 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 60 ms
22,444 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