結果
| 問題 |
No.188 HAPPY DAY
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-02 23:14:01 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 1,000 ms |
| コード長 | 865 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,160 KB |
| 最終ジャッジ日時 | 2024-12-31 05:52:01 |
| 合計ジャッジ時間 | 930 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
class HAPPY_DAY
def initialize
@days = {
1 => 31,
2 => 28,
3 => 31,
4 => 30,
5 => 31,
6 => 30,
7 => 31,
8 => 31,
9 => 30,
10 => 31,
11 => 30,
12 => 31
}
@cnt = 0
end
def happy_day
(1..12).each do |month|
(1..@days[month]).each do |day|
d1, d2 = day.to_s.split("")
d2 = "0" if d2.nil?
@cnt += 1 if month == d1.to_i + d2.to_i
end
end
@cnt
end
def dataoutput
puts happy_day
end
def run
dataoutput
end
end
if $0 == __FILE__
HAPPY_DAY.new.run
end