結果
| 問題 | No.188 HAPPY DAY |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-12 10:55:28 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 906 bytes |
| コンパイル時間 | 4,193 ms |
| コンパイル使用メモリ | 174,772 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 01:31:06 |
| 合計ジャッジ時間 | 4,768 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
コンパイルメッセージ
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