-
-
Save Nucleareal/7928413 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
import Control.Applicative | |
import Data.Char | |
import Data.List | |
split :: (a -> Bool) -> [a] -> [[a]] | |
split p [] = [] | |
split p xs = a : (split p $ dropWhile p $ b) where (a, b) = break p xs | |
splitBySpace :: String -> [String] | |
splitBySpace = split isSpace | |
getStair :: Integer -> Integer | |
getStair 0 = 1 | |
getStair x = x * (getStair (x-1)) | |
main :: IO() | |
main = do | |
rc <- getLine | |
xy <- getLine | |
dl <- getLine | |
let rci = map (\x -> read x :: Int) $ splitBySpace rc | |
let xyi = map (\x -> read x :: Int) $ splitBySpace xy | |
let dli = map (\x -> read x :: Int) $ splitBySpace dl | |
let vr = ((head rci) - (head xyi)) * ((head $ (tail rci)) - (head $ (tail xyi))) | |
let nn = (head xyi) * (head $ (tail xyi)) | |
let mm = head dli | |
let un = getStair (fromIntegral(nn) :: Integer) | |
let sn = (getStair (fromIntegral(mm) :: Integer)) * (getStair (fromIntegral(nn - mm) :: Integer)) | |
let ncm = un `div` sn | |
let ans = (ncm * (fromIntegral(vr) :: Integer)) `mod` (1000000007 :: Integer) | |
putStrLn $ show ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment