結果

問題 No.170 スワップ文字列(Easy)
ユーザー nuwasogi
提出日時 2015-11-24 14:38:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 284 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-12-23 00:32:58
合計ジャッジ時間 1,648 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
S = input()
n = len(S)
dict = {}
for x in S:
    if x in dict:
        dict[x] +=1
    else:
        dict[x] = 1
list1 = dict.values()
list1 = list(filter(lambda x : x!=1, list1))
ans = factorial(n)
for x in list1:
    ans //= factorial(x)
ans-=1
print(ans)
0