結果
問題 | No.188 HAPPY DAY |
ユーザー | momen999 |
提出日時 | 2017-04-12 10:55:28 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 6,761 ms |
コンパイル使用メモリ | 171,392 KB |
実行使用メモリ | 6,812 KB |
最終ジャッジ日時 | 2024-06-09 21:48:40 |
合計ジャッジ時間 | 5,050 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
calendar2015 :: [(Int, Int)] calendar2015 = [(1,31), (2,28), (3,31), (4,30), (5,31), (6,30), (7,31), (8,31), (9,30), (10,31), (11,30), (12,31)] happyDay :: Int -> Int -> Bool happyDay m d | m == d_10 + d_01 = True | otherwise = False where d_10 = floor $ (fromIntegral (d :: Int)) / 10.0 d_01 = d - d_10 * 10 happyDayCounter :: [(Int, Int)] -> Int happyDayCounter [] = 0 happyDayCounter (c:cs) = do let m = fst c d = snd c days = [1..d] happyDayCounter' m days + happyDayCounter cs where happyDayCounter' :: Int -> [Int] -> Int happyDayCounter' _ [] = 0 happyDayCounter' m (d:ds) -- = cnt + happyDayCounter' m ds | happyDay m d == True = happyDayCounter' m ds + 1 | otherwise = happyDayCounter' m ds main = print $ happyDayCounter calendar2015