Created
January 9, 2020 08:52
-
-
Save cm-kazup0n/5f29773179e7eeda994ab8557975eaec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ABC087B - Coins | |
-- https://atcoder.jp/contests/abs/tasks/abc087_b | |
type X = Int | |
type A = Int | |
type B = Int | |
type C = Int | |
isDigitCombiMatch:: X -> (A, B, C) -> Bool | |
isDigitCombiMatch x (a,b,c) = (50*c + 100*b + 500*a) == x | |
generateCombi:: (A,B,C) -> [(A,B,C)] | |
generateCombi (a,b,c) = filter (\(n1,n2,n3) -> n1+n2+n3 >= 1) [(aa, bb, cc) | aa <- [0..a],bb <- [0..b],cc <- [0..c]] | |
main = do | |
a <- fmap parseToInt getLine | |
b <- fmap parseToInt getLine | |
c <- fmap parseToInt getLine | |
x <- fmap parseToInt getLine | |
let ans = (filter (isDigitCombiMatch x) (generateCombi (a,b,c)) ) | |
-- putStrLn $ show ans | |
putStrLn $ show (length ans) | |
where | |
parseToInt :: String -> Int | |
parseToInt s = read s ::Int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment