fork download
  1. main = do
  2. m:n:k:_ <- fmap (map read . words) getLine
  3. matr <- fmap (map (map (read . return)) . lines) getContents
  4. let f g i xs = [g (take i' . drop i'') xs | i' <- [1..i], i'' <- [0..i - i']]
  5. print $ sum [1 | matr' <- f id n matr, matr'' <- f concatMap m matr', sum matr'' == k]
Success #stdin #stdout 0s 6352KB
stdin
5 5 6
01010
10101
01010
10101
01010
stdout
12