結果
問題 | No.171 スワップ文字列(Med) |
ユーザー | はむ吉🐹 |
提出日時 | 2015-11-15 13:50:58 |
言語 | Haskell (9.6.2) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 441 bytes |
コンパイル時間 | 678 ms |
コンパイル使用メモリ | 163,484 KB |
実行使用メモリ | 8,764 KB |
最終ジャッジ日時 | 2023-10-11 16:20:59 |
合計ジャッジ時間 | 2,045 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,668 KB |
testcase_01 | AC | 3 ms
6,788 KB |
testcase_02 | AC | 3 ms
7,652 KB |
testcase_03 | AC | 3 ms
6,948 KB |
testcase_04 | AC | 3 ms
7,032 KB |
testcase_05 | AC | 3 ms
7,684 KB |
testcase_06 | AC | 4 ms
8,140 KB |
testcase_07 | AC | 4 ms
8,328 KB |
testcase_08 | AC | 5 ms
8,764 KB |
testcase_09 | AC | 4 ms
8,524 KB |
testcase_10 | AC | 2 ms
6,808 KB |
testcase_11 | AC | 3 ms
6,852 KB |
testcase_12 | AC | 2 ms
6,860 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
ソースコード
import Data.List (group, sort) factorial :: Integral a => a -> a factorial 0 = 1 factorial 1 = 1 factorial n = n * factorial (n - 1) getPermutations :: String -> Integer getPermutations s = flip mod 573 $ subtract 1 $ factorial l `div` (product . map factorial) ns where l = fromIntegral $ length s ns = map fromIntegral $ map length $ group $ sort s main :: IO () main = print . getPermutations =<< getLine