結果

問題 No.170 スワップ文字列(Easy)
ユーザー taktak
提出日時 2019-06-10 17:08:05
言語 F#
(.NET 7)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 3,380 ms
コンパイル使用メモリ 162,304 KB
実行使用メモリ 24,152 KB
最終ジャッジ日時 2023-07-28 11:44:01
合計ジャッジ時間 6,219 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
22,116 KB
testcase_01 AC 61 ms
22,228 KB
testcase_02 AC 60 ms
20,180 KB
testcase_03 AC 61 ms
22,072 KB
testcase_04 AC 61 ms
21,960 KB
testcase_05 AC 61 ms
22,120 KB
testcase_06 AC 63 ms
24,124 KB
testcase_07 AC 61 ms
21,992 KB
testcase_08 AC 60 ms
24,004 KB
testcase_09 AC 61 ms
20,068 KB
testcase_10 AC 62 ms
24,108 KB
testcase_11 AC 61 ms
22,020 KB
testcase_12 AC 61 ms
22,040 KB
testcase_13 AC 62 ms
22,088 KB
testcase_14 AC 60 ms
19,916 KB
testcase_15 AC 62 ms
22,192 KB
testcase_16 AC 61 ms
22,060 KB
testcase_17 AC 62 ms
24,116 KB
testcase_18 AC 60 ms
21,948 KB
testcase_19 AC 61 ms
24,152 KB
testcase_20 AC 61 ms
24,012 KB
testcase_21 AC 62 ms
24,092 KB
testcase_22 AC 61 ms
22,156 KB
testcase_23 AC 60 ms
22,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

module Yuki

open System

let solve (s : string) =    

    let fact =
        let rec f acc =
            function
            | 1 -> acc
            | n -> f (acc * n) (n - 1)
        f 1 
    s.ToCharArray()
    |> Array.countBy id    
    |> Array.map snd
    |> Array.fold (fun acc x -> acc / (fact x)) (fact s.Length)
    |> fun x -> x - 1

let S = Console.ReadLine()

solve S
|> Console.WriteLine
0