読者です 読者をやめる 読者になる 読者になる

Project Euler 19

Problem 19

using System;

class PE019 {
    static void Main() {
        int ans = 0;

        var d = new DateTime(1901, 1, 1);
        var endDate = new DateTime(2000, 12, 31);
        while (d < endDate) {
            if (d.DayOfWeek == DayOfWeek.Sunday) {
                ans++;
            }
            d = d.AddMonths(1);
        }
        Console.WriteLine(ans);
    }
}