結果

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

ソースコード

diff #

def comb(n, r):
    res = 1
    for i in range(r):
        res *= n-i
    for i in range(r):
        res /= i+1
    return int(res)

a = [0 for i in range(26)]
s = input()
for i in s:
    a[ord(i)-ord('A')] += 1
n = len(s)
res = 1
for i in a:
    res *= comb(n, i)
    n -= i
print(res-1)
0