結果

問題 No.171 スワップ文字列(Med)
ユーザー okadukiokaduki
提出日時 2015-03-22 23:45:54
言語 Haskell
(9.6.2)
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 593 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 163,744 KB
実行使用メモリ 11,296 KB
最終ジャッジ日時 2023-09-11 09:36:05
合計ジャッジ時間 1,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,836 KB
testcase_01 AC 2 ms
6,892 KB
testcase_02 AC 3 ms
7,604 KB
testcase_03 AC 3 ms
7,120 KB
testcase_04 AC 3 ms
7,224 KB
testcase_05 AC 4 ms
9,360 KB
testcase_06 AC 4 ms
8,796 KB
testcase_07 AC 5 ms
10,452 KB
testcase_08 AC 5 ms
9,280 KB
testcase_09 AC 8 ms
11,296 KB
testcase_10 AC 2 ms
6,792 KB
testcase_11 AC 3 ms
6,816 KB
testcase_12 AC 3 ms
7,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

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 = map toInteger . map length . group . sort

main = do
  s <- getLine
  print $ (`mod` 573) $ (f (toInteger $ length s) $ g s) - 1
0