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("700"); //2 } else if (InputPattern == "Input2") { WillReturn.Add("550"); //1 } else if (InputPattern == "Input3") { WillReturn.Add("2300"); //5 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static long[] GetSplitArr(string pStr) { return (pStr == "" ? new string[0] : pStr.Split(' ')).Select(pX => long.Parse(pX)).ToArray(); } static long mN; static void Main() { List InputList = GetInputList(); mN = long.Parse(InputList[0]); long L = 0; long R = mN * 500; if (mN < 100) { Console.WriteLine(0); } while (L + 1 < R) { long Mid = R / 2; if (R < long.MaxValue) { Mid = (L + R) / 2; } if (CanAchieve(Mid)) { R = Mid; } else { L = Mid; } } Console.WriteLine(R); } // Xが解かをを返す static bool CanAchieve(long pX) { long Result = mN - 500 * pX; return Result < 100; } }