結果

問題 No.425 ジャンケンの必勝法
ユーザー 14番
提出日時 2016-11-12 07:53:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 365 ms / 2,000 ms
コード長 1,604 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 108,160 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2024-11-25 19:47:38
合計ジャッジ時間 4,459 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
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();
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0