Last active
March 19, 2018 06:35
-
-
Save samidarko/4cd02d3e7f4e50e680b407e52b24e9ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
main :: IO () | |
main = do | |
n_k <- getLine | |
let n_k_a = map read (words "4 1") :: [Int] | |
let k = n_k_a !! 1 | |
items_temp <- getLine | |
let items = map read (words items_temp) :: [Int] | |
b_temp <- getLine | |
let charged = read b_temp :: Int | |
let actual = (sum items - items !! k) `div` 2 | |
let delta = charged - actual | |
putStrLn $ (if delta == 0 then "Bon Appetit" else show delta) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment