-
-
Save t0yv0/1114650 to your computer and use it in GitHub Desktop.
Project Euler -- Problem 19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let euler19 () = | |
let mutable k = 0 | |
for y in 1901 .. 2000 do | |
for m in 1 .. 12 do | |
let date = System.DateTime(y, m, 1) | |
if date.DayOfWeek = System.DayOfWeek.Sunday then | |
k <- k + 1 | |
k | |
stdout.WriteLine(euler19 ()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from calendar import Calendar | |
counter = 0 | |
iterator = Calendar() | |
for y in xrange(1901,2001): | |
for m in xrange(1,13): | |
for d in iterator.itermonthdays2(y,m): | |
if d == (1,6): | |
counter += 1 | |
print counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment