require 'date' class Yukicoder def initialize start = Date.new(2015, 1, 1) count = 0 365.times do |i| date = start + i month = date.month day = date.day if month == day.to_s.chars.map(&:to_i).inject(:+) count += 1 end end puts count end end Yukicoder.new