結果

問題 No.171 スワップ文字列(Med)
ユーザー nebukuro09nebukuro09
提出日時 2016-09-21 15:19:53
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 454 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 76,784 KB
実行使用メモリ 79,612 KB
最終ジャッジ日時 2024-04-28 16:44:55
合計ジャッジ時間 2,700 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
77,600 KB
testcase_01 AC 97 ms
77,816 KB
testcase_02 AC 129 ms
78,848 KB
testcase_03 AC 102 ms
78,428 KB
testcase_04 AC 100 ms
77,824 KB
testcase_05 WA -
testcase_06 AC 141 ms
79,332 KB
testcase_07 AC 154 ms
78,848 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 96 ms
77,952 KB
testcase_11 AC 99 ms
77,568 KB
testcase_12 AC 99 ms
77,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
import operator
MOD = 573

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

c = Counter(raw_input()).values()
bunbo = range(sum(c), 0, -1)
for n in c:
    for m in xrange(1, n+1):
        p = 0
        while m > 1:
            cd = gcd(m, bunbo[p])
            if cd > 1:
                bunbo[p] /= cd
                m /= cd
            p += 1

ans = 1
for b in bunbo:
    ans = ans * b % MOD
print ans-1
0