My try to solve Project Euler problem no. 19 in Ruby
require 'date'
time = DateTime.new(1901,1,1)
concur = 0
while time.year < 2001 do
if time.wday == 0
puts time.strftime("%Y-%m-%d") + ": Yes"
concur += 1
end
time = time >> 1
end
puts "Total concurrent: " + concur.to_s
No comments:
Post a Comment