結果
問題 | No.170 スワップ文字列(Easy) |
ユーザー | okaduki |
提出日時 | 2015-03-22 23:40:00 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 5,289 ms |
コンパイル使用メモリ | 173,184 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 04:41:57 |
合計ジャッジ時間 | 6,151 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Text.Printf import Data.List import Debug.Trace -- or readInteger readInts :: B.ByteString -> [Int] readInts = map (fst . fromJust . B.readInt) . B.words getInts :: IO [Int] getInts = liftM readInts B.getLine f n [] = 1 f n (x:xs) = c n x * f (n-x) xs where c n m = product [1..n] `div` product [1..m] `div` product [1..(n-m)] g :: String -> [Int] g = map length . group . sort main = do s <- getLine print $ (f (length s) $ g s) - 1