using System; using System.Collections; using System.Collections.Generic; using System.Linq; public class Program{ public static void Main(){ List days = Enumerable.Range(1,31).ToList(); List _d = days.Select(s => GetDaySum(s)).ToList(); int overCount = _d.Count(c => 0 < c && c < 13); int outCount = 0; var _out = new List(); _out.Add(new Out(2,29)); _out.Add(new Out(2,30)); _out.Add(new Out(2,31)); _out.Add(new Out(4,31)); _out.Add(new Out(6,31)); _out.Add(new Out(9,31)); _out.Add(new Out(11,31)); foreach (var o in _out){ if (o.Month == GetDaySum(o.Day)){ outCount++; } } Console.WriteLine(overCount - outCount); } public static int GetDaySum(int d){ if (d < 10) return d; return (d / 10) + (d % 10); } } public class Out{ public int Month { get; set; } public int Day { get; set; } public Out(int m, int d){ Month = m; Day = d; } }