結果

問題 No.171 スワップ文字列(Med)
ユーザー 👑 yumechiyumechi
提出日時 2015-09-23 06:10:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 343 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 75,548 KB
最終ジャッジ日時 2023-09-26 14:34:44
合計ジャッジ時間 2,218 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,288 KB
testcase_01 AC 75 ms
71,376 KB
testcase_02 AC 75 ms
71,488 KB
testcase_03 AC 76 ms
75,444 KB
testcase_04 AC 76 ms
75,448 KB
testcase_05 AC 78 ms
75,548 KB
testcase_06 AC 77 ms
75,500 KB
testcase_07 AC 77 ms
71,472 KB
testcase_08 AC 81 ms
75,536 KB
testcase_09 AC 86 ms
75,336 KB
testcase_10 AC 75 ms
71,452 KB
testcase_11 AC 76 ms
71,200 KB
testcase_12 AC 78 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial

S = input()
dic = dict()
for c in S:
    if c not in dic:
        dic.update({c:1})
    else:
        dic[c] += 1

length = len(S)
res = 1
vs = [i for i in dic.values()]
vs.sort()
vs = vs[::-1]

for i in vs:
    res *= factorial(length) // (factorial(length - i) * factorial(i))
    length -= i
print((res-1) % 573)
0