結果

問題 No.188 HAPPY DAY
ユーザー osyo-mangaosyo-manga
提出日時 2020-09-09 19:40:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 428 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 11,508 KB
実行使用メモリ 15,212 KB
最終ジャッジ日時 2023-08-22 08:38:30
合計ジャッジ時間 1,064 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "date"

module M
  refine Integer do
    def sum
      # to_s.chars.map(&:to_i).sum
      self / 10 + self % 10
    end
  end

  refine Date do
    def happy_day?
      month == day.sum
    end
  end
end
using M

puts (Date.new(2015, 1, 1)..Date.new(2015, 12, 31)).select(&:happy_day?).count
# puts (Date.new(2015, 1, 1)..Date.new(2015, 12, 31)).count(&:happy_day?)


# date = Date.new(1993, 2, 24)
# pp date.happy_day?
0