結果
問題 | No.188 HAPPY DAY |
ユーザー | momen999 |
提出日時 | 2017-04-12 10:55:28 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 5,094 ms |
コンパイル使用メモリ | 161,392 KB |
実行使用メモリ | 6,592 KB |
最終ジャッジ日時 | 2023-08-29 22:30:13 |
合計ジャッジ時間 | 2,313 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/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