結果

問題 No.171 スワップ文字列(Med)
ユーザー GrayCoder
提出日時 2018-08-11 17:52:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 342 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-23 06:20:26
合計ジャッジ時間 1,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from math import factorial
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    S = input()

    n1, n2 = factorial(len(S)), 1
    cnt = Counter(S)
    for i in cnt.values():
        n2 *= factorial(i)
    n = (n1 // n2) - 1
    print(n % 573)

main()
0