using System; using System.Collections.Generic; public class Program { public void Proc() { Reader.IsDebug = false; int cnt = int.Parse(Reader.ReadLine()); for(int i=0; i[Goal + 1]; this.CanWinDic[Goal - 1] = false; for(int i=1; i<=len; i++) { int idx = Math.Max(0, Goal - 1 - i); this.CanWinDic[idx] = true; } return CanWin(0); } private int Goal = 0; private int MoveLen = 0; private Nullable[] CanWinDic; private bool CanWin(int num) { if(this.CanWinDic[num] != null) { return this.CanWinDic[num].Value; } bool isOnlyWin = true; for(int i=1; i<=MoveLen; i++) { if(num + i < Goal) { if(!this.CanWin(num + i)) { isOnlyWin = false; } } } this.CanWinDic[num] = !isOnlyWin; return this.CanWinDic[num].Value; } public class Reader { private static String InitText = @" 3 5 10 40 6 100 8 "; private static System.IO.StringReader sr = null; public static bool IsDebug = true; public static string ReadLine() { if(IsDebug) { if(sr == null) { sr = new System.IO.StringReader(InitText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ') { string[] inpt = ReadLine().Split(delimiter); int[] ret = new int[inpt.Length]; for(int i=0; i