結果

問題 No.425 ジャンケンの必勝法
ユーザー 14番14番
提出日時 2016-11-12 07:53:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 422 ms / 2,000 ms
コード長 1,604 bytes
コンパイル時間 2,590 ms
コンパイル使用メモリ 104,156 KB
実行使用メモリ 24,208 KB
最終ジャッジ日時 2023-08-17 02:33:38
合計ジャッジ時間 6,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
22,080 KB
testcase_01 AC 72 ms
22,112 KB
testcase_02 AC 72 ms
21,964 KB
testcase_03 AC 75 ms
20,076 KB
testcase_04 AC 168 ms
24,208 KB
testcase_05 AC 79 ms
21,920 KB
testcase_06 AC 189 ms
21,912 KB
testcase_07 AC 159 ms
22,084 KB
testcase_08 AC 82 ms
22,072 KB
testcase_09 AC 75 ms
24,068 KB
testcase_10 AC 71 ms
20,008 KB
testcase_11 AC 78 ms
22,056 KB
testcase_12 AC 109 ms
21,944 KB
testcase_13 AC 383 ms
22,064 KB
testcase_14 AC 122 ms
21,972 KB
testcase_15 AC 74 ms
21,980 KB
testcase_16 AC 80 ms
23,968 KB
testcase_17 AC 79 ms
24,064 KB
testcase_18 AC 73 ms
24,048 KB
testcase_19 AC 72 ms
22,104 KB
testcase_20 AC 82 ms
20,052 KB
testcase_21 AC 422 ms
22,044 KB
testcase_22 AC 396 ms
20,112 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.Text;
using System.Linq;
using System.Collections.Generic;

public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        decimal baseNum = 100m/3;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();

        this.p0 =inpt[0];
        this.q = inpt[1];

        decimal ans = this.GetAns( baseNum, (decimal)p0) + baseNum;
        Console.WriteLine(ans/100);
    }

    private decimal GetAns(decimal current, decimal p1) {
        if((current < 1/100000000000m)) {
            return current;
        }
        decimal useHissyo = current * p1 / 100;
        decimal ans = 0;
        if(useHissyo > 0) {
            ans += useHissyo / 2;
            ans += GetAns(useHissyo / 2, Math.Max(p1-q, 0));
        }
        ans += (current - useHissyo) / 3;
        ans += GetAns((current-useHissyo)/3, Math.Min(p1+q, 100));
        return ans;
    
    }

    private int p0;
    private int q;


    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"

0 0

";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0