結果

問題 No.524 コインゲーム
ユーザー 14番14番
提出日時 2017-06-02 23:52:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 1,000 ms
コード長 1,716 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 113,988 KB
実行使用メモリ 26,088 KB
最終ジャッジ日時 2024-04-10 08:43:38
合計ジャッジ時間 2,663 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
25,712 KB
testcase_01 AC 23 ms
26,088 KB
testcase_02 AC 24 ms
24,112 KB
testcase_03 AC 22 ms
21,816 KB
testcase_04 AC 23 ms
24,036 KB
testcase_05 AC 23 ms
23,828 KB
testcase_06 AC 23 ms
23,756 KB
testcase_07 AC 22 ms
23,632 KB
testcase_08 AC 21 ms
23,656 KB
testcase_09 AC 21 ms
23,552 KB
testcase_10 AC 21 ms
23,912 KB
testcase_11 AC 22 ms
23,752 KB
testcase_12 AC 22 ms
23,984 KB
testcase_13 AC 22 ms
23,752 KB
testcase_14 AC 21 ms
23,888 KB
testcase_15 AC 22 ms
23,628 KB
testcase_16 AC 22 ms
21,808 KB
testcase_17 AC 23 ms
25,584 KB
testcase_18 AC 22 ms
25,836 KB
testcase_19 AC 22 ms
24,112 KB
testcase_20 AC 23 ms
26,084 KB
testcase_21 AC 24 ms
26,080 KB
testcase_22 AC 22 ms
24,016 KB
testcase_23 AC 23 ms
25,832 KB
testcase_24 AC 22 ms
23,756 KB
testcase_25 AC 22 ms
23,628 KB
testcase_26 AC 22 ms
23,884 KB
testcase_27 AC 21 ms
23,752 KB
testcase_28 AC 21 ms
25,680 KB
testcase_29 AC 21 ms
25,696 KB
testcase_30 AC 22 ms
25,576 KB
testcase_31 AC 22 ms
25,824 KB
testcase_32 AC 23 ms
23,884 KB
testcase_33 AC 22 ms
24,024 KB
testcase_34 AC 23 ms
25,840 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.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);
        long num = long.Parse(Reader.ReadLine());
		Console.WriteLine((num % 4 == 3) ? "X" : "O");
		
	}


    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