結果

問題 No.171 スワップ文字列(Med)
ユーザー しらっ亭しらっ亭
提出日時 2015-09-18 01:57:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 185 ms / 1,000 ms
コード長 501 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 65,824 KB
最終ジャッジ日時 2023-09-26 12:23:59
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,424 KB
testcase_01 AC 20 ms
8,328 KB
testcase_02 AC 69 ms
23,184 KB
testcase_03 AC 19 ms
8,540 KB
testcase_04 AC 20 ms
8,428 KB
testcase_05 AC 45 ms
15,956 KB
testcase_06 AC 110 ms
35,452 KB
testcase_07 AC 166 ms
57,644 KB
testcase_08 AC 183 ms
65,808 KB
testcase_09 AC 185 ms
65,824 KB
testcase_10 AC 18 ms
8,384 KB
testcase_11 AC 18 ms
8,476 KB
testcase_12 AC 18 ms
8,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def combi(n):
    c = [[0 for i in range(n + 1)] for j in range(n + 1)]
    for x in range(n + 1):
        c[x][0] = 1
        for y in range(1, x + 1):
            c[x][y] = (c[x - 1][y] + c[x - 1][y - 1])
    return c


def solve():
    S = input()
    L = len(S)

    mod = 573

    C = combi(L)

    co = Counter(S)

    ans = 1

    for n in co.values():
        ans *= C[L][n]
        L -= n

    print((ans - 1) % mod)


if __name__ == '__main__':
    solve()
0