結果
| 問題 |
No.425 ジャンケンの必勝法
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-11-12 07:52:43 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,637 bytes |
| コンパイル時間 | 4,729 ms |
| コンパイル使用メモリ | 110,000 KB |
| 実行使用メモリ | 25,388 KB |
| 最終ジャッジ日時 | 2024-11-25 19:45:51 |
| 合計ジャッジ時間 | 2,875 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 4 |
| other | WA * 18 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public void Proc() {
Reader.IsDebug = false;
Reader.IsDebug = true;
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 = @"
20 80
";
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();
}
}
14番