結果

問題 No.171 スワップ文字列(Med)
ユーザー nebukuro09nebukuro09
提出日時 2016-09-21 15:21:02
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 147 ms / 1,000 ms
コード長 460 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 76,800 KB
実行使用メモリ 79,360 KB
最終ジャッジ日時 2024-04-28 16:44:59
合計ジャッジ時間 2,369 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
77,740 KB
testcase_01 AC 81 ms
77,500 KB
testcase_02 AC 113 ms
78,720 KB
testcase_03 AC 84 ms
78,080 KB
testcase_04 AC 82 ms
78,212 KB
testcase_05 AC 99 ms
78,848 KB
testcase_06 AC 125 ms
79,296 KB
testcase_07 AC 133 ms
78,972 KB
testcase_08 AC 146 ms
79,232 KB
testcase_09 AC 147 ms
79,360 KB
testcase_10 AC 82 ms
77,440 KB
testcase_11 AC 79 ms
77,568 KB
testcase_12 AC 83 ms
77,380 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)%MOD
0