using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("14"); //12 //最も大きい四角形は横4cm、縦3cmの長方形です。 //面積は4×3なので12が答えです。 } else if (InputPattern == "Input2") { WillReturn.Add("15"); //12 //サンプル1と同じです。 //A君は鉛筆を使い切らないといけないわけではありません。 } else if (InputPattern == "Input3") { WillReturn.Add("16"); //16 //1辺が4cmの正方形が描けます。面積は16です } else if (InputPattern == "Input4") { WillReturn.Add("3"); //0 //四角形が描けないときの面積は0です } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); int D = int.Parse(InputList[0]); int MaxMenseki = 0; for (int X = 1; X * 2 <= D; X++) { for (int Y = X; X * 2 + Y * 2 <= D; Y++) { int Memseki = X * Y; if (MaxMenseki < Memseki) MaxMenseki = Memseki; } } Console.WriteLine(MaxMenseki); } }