using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input3"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("1 1"); WillReturn.Add("1 0"); //1 } else if (InputPattern == "Input2") { WillReturn.Add("10 1"); WillReturn.Add("1 0"); //10 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); int[] wkArr = { }; Action SplitAct = (pStr) => wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray(); SplitAct(InputList[0]); int GoalX = wkArr[0], GoalY = wkArr[1]; SplitAct(InputList[1]); int HuX = wkArr[0], HuY = wkArr[1]; int Tesuu = Math.Max(GoalX, GoalY); //迂回が必要かを判定 if (GoalX == GoalY && HuX == HuY && HuX < GoalX) Tesuu++; Console.WriteLine(Tesuu); } }