結果

問題 No.524 コインゲーム
ユーザー 14番14番
提出日時 2017-06-02 23:49:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,835 bytes
コンパイル時間 969 ms
コンパイル使用メモリ 112,372 KB
実行使用メモリ 24,056 KB
最終ジャッジ日時 2023-10-22 01:54:51
合計ジャッジ時間 2,979 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,952 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 26 ms
23,956 KB
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 26 ms
23,956 KB
testcase_09 AC 26 ms
23,956 KB
testcase_10 AC 26 ms
23,956 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 26 ms
23,956 KB
testcase_17 AC 26 ms
23,956 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 26 ms
23,956 KB
testcase_21 WA -
testcase_22 AC 26 ms
23,956 KB
testcase_23 AC 26 ms
23,956 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 26 ms
23,952 KB
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        IsWin.Add(1, true);
        IsWin.Add(2, true);
        IsWin.Add(3, false);
        IsWin.Add(4, true);
        int num = int.Parse(Reader.ReadLine());
        if(IsWin.ContainsKey(num)) {
            Console.WriteLine(IsWin[num]?"O":"X");
        } else {
            Console.WriteLine((num % 4 == 3) ? "X":"0");
        }

	}


    Dictionary<string, bool> dic = new Dictionary<string, bool>();
    private bool GetAns(List<int> num) {
        if(num.Count == 1) {
            return true;
        }
        if(num.Count == 0) {
            return false;
        }
        string key = string.Join("", num.Where(a=>a>0).OrderBy(a => a));
        if(dic.ContainsKey(key)) {
            return dic[key];
        }
        for (int i = 0; i < num.Count; i++) {
            for (int j = 1; j <= num[i]; j++) {
                List<int> tmp = new List<int>();
                tmp.AddRange(num);
                tmp[i] -= j;
                if(!GetAns(tmp)) {
                    dic[key] = true;
                    return true;
                }
            }
        }
        dic[key] = false;
        return false;
 
    }


    Dictionary<int, bool> IsWin = new Dictionary<int, bool>();

	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"

3



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}
0