結果
| 問題 |
No.425 ジャンケンの必勝法
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-11-12 07:52:11 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,633 bytes |
| コンパイル時間 | 5,058 ms |
| コンパイル使用メモリ | 114,072 KB |
| 実行使用メモリ | 27,528 KB |
| 最終ジャッジ日時 | 2024-11-25 19:44:04 |
| 合計ジャッジ時間 | 6,699 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 5 |
| 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);
}
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番