結果

問題 No.171 スワップ文字列(Med)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-27 20:36:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 11,872 KB
実行使用メモリ 23,180 KB
最終ジャッジ日時 2023-10-24 18:38:37
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,108 KB
testcase_01 AC 30 ms
10,108 KB
testcase_02 AC 134 ms
14,812 KB
testcase_03 AC 31 ms
10,172 KB
testcase_04 AC 31 ms
10,184 KB
testcase_05 WA -
testcase_06 AC 196 ms
17,680 KB
testcase_07 AC 289 ms
21,996 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 29 ms
10,108 KB
testcase_11 AC 30 ms
10,108 KB
testcase_12 AC 30 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from collections import Counter

s = Counter(input())
li = list(s.values())
N = sum(li)

mod = 573
C = [ [0] * (N + 1) for i in range(N + 1) ]
for i in range(N + 1):
    C[i][0] = 1
    for j in range(1, i + 1):
        C[i][j] = C[i - 1][j] + C[i - 1][j - 1]
        if C[i][j] >= mod:
            C[i][j] -= mod

ans = 1
rem = N
for x in li:
    ans = ans * C[rem][x] % mod
    rem -= x
print(ans - 1)
0