結果
| 問題 | No.171 スワップ文字列(Med) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-23 06:10:06 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 1,000 ms |
| + 167µs | |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 246 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 83,072 KB |
| 最終ジャッジ日時 | 2026-08-18 08:50:01 |
| 合計ジャッジ時間 | 2,460 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
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)