結果

問題 No.170 スワップ文字列(Easy)
ユーザー lloyzlloyz
提出日時 2023-05-29 00:02:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 232 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 8,492 KB
最終ジャッジ日時 2023-08-27 17:53:19
合計ジャッジ時間 1,819 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,392 KB
testcase_01 AC 19 ms
8,348 KB
testcase_02 AC 19 ms
8,384 KB
testcase_03 AC 18 ms
8,312 KB
testcase_04 AC 19 ms
8,444 KB
testcase_05 AC 19 ms
8,328 KB
testcase_06 AC 19 ms
8,380 KB
testcase_07 AC 19 ms
8,364 KB
testcase_08 AC 19 ms
8,316 KB
testcase_09 AC 19 ms
8,332 KB
testcase_10 AC 19 ms
8,364 KB
testcase_11 AC 19 ms
8,304 KB
testcase_12 AC 19 ms
8,332 KB
testcase_13 AC 19 ms
8,296 KB
testcase_14 AC 19 ms
8,436 KB
testcase_15 AC 19 ms
8,360 KB
testcase_16 AC 19 ms
8,452 KB
testcase_17 AC 19 ms
8,448 KB
testcase_18 AC 19 ms
8,484 KB
testcase_19 AC 19 ms
8,492 KB
testcase_20 AC 19 ms
8,304 KB
testcase_21 AC 19 ms
8,360 KB
testcase_22 AC 19 ms
8,376 KB
testcase_23 AC 19 ms
8,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

s = input()

n = len(s)
F = [1 for _ in range(n + 1)]
for i in range(n):
    F[i + 1] = (i + 1) * F[i]

counter = Counter(s)
ans = F[n]
for cnt in counter.values():
    ans //= F[cnt]
print(ans - 1)
0