結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2016-02-26 23:15:59 |
言語 | Haskell (9.10.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 4,284 ms |
コンパイル使用メモリ | 174,592 KB |
実行使用メモリ | 13,880 KB |
最終ジャッジ日時 | 2024-09-22 23:07:04 |
合計ジャッジ時間 | 7,860 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 10 TLE * 1 -- * 12 |
コンパイルメッセージ
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
ソースコード
main :: IO () main = do s <- getLine putStrLn . show $ f s f :: String -> Int f ('c':xs) | length s < 2 = 0 | otherwise = bc (length s) 2 + f xs where s = filter ((==) 'w') xs f (_:xs) = f xs f _ = 0 bc :: Int -> Int -> Int bc _ 0 = 1 bc n k | n < 0 = 0 | n == k = 1 | otherwise = bc (n - 1) (k - 1) + bc (n - 1) k