using System; using System.Linq; using System.Text; using System.Collections.Generic; public class Program { public void Proc() { Reader.IsDebug = false; int max = 12345; List inpt = new List(); inpt.Add(Reader.ReadLine()); inpt.Add(Reader.ReadLine()); bool ans = true; if(inpt.Any(a=>a.Any(b=>b<'0' || b>'9'))) { ans = false; } if(ans && inpt.Any(a=>!int.Parse(a).ToString().Equals(a))) { ans = false; } if(ans && inpt.Any(a=>int.Parse(a) > max)) { ans = false; } Console.WriteLine(ans?"OK":"NG"); } public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" 123 4eF "; 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(); } }