using System; using System.Collections.Generic; using System.Linq; class Program { public void Solve() { DateTime chkDate = new DateTime(2015, 1, 1); int happyDayCnt = 0; int dayNum1 = 0, dayNum2 = 0; while (chkDate != new DateTime(2015, 12, 31)) { dayNum1 = chkDate.Day.ToString("00").ToArray()[0] - 48; dayNum2 = chkDate.Day.ToString("00").ToArray()[1] - 48; if (chkDate.Month == dayNum1 + dayNum2) { happyDayCnt++; }; chkDate = chkDate.AddDays(1); } Console.WriteLine(happyDayCnt); } static void Main() { var solver = new Program(); solver.Solve(); } }