Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Control.Applicative
import Data.List
import Control.Monad
strToInt s = (read :: String -> Integer) s
main :: IO ()
main = do
-- 整数の入力
n <- readLn
-- kaigyousuuretu
ts <- sort <$> map strToInt <$> replicateM n getLine
-- 出力
let m = 1000000007 :: Integer
putStrLn . show . sum $ scanl' (+) 0 ts
putStrLn . show . (`mod` m) . product $ map ((\n -> foldl1' (*) [1..n]) . length') $ group ts
length' :: [Integer] -> Integer
length' xs = fromIntegral $ length xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.