結果
| 問題 | No.170 スワップ文字列(Easy) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-09-18 16:08:45 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 31 ms / 5,000 ms | 
| コード長 | 320 bytes | 
| コンパイル時間 | 81 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-18 07:59:48 | 
| 合計ジャッジ時間 | 1,400 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
import math
S = input()
l = list(S)
ld = []
l.sort()
ck = l[0]
count = 0
for l_i in l:
    if ck == l_i:
        count += 1
    else:
        ld.append(count)
        count = 1
    ck = l_i
ld.append(count)
mom = 1
for l_i in ld:
    mom *= math.factorial(l_i)
ans = math.factorial(len(l)) // mom
    
print(ans - 1)
            
            
            
        