結果

問題 No.346 チワワ数え上げ問題
ユーザー teruneterune
提出日時 2016-09-06 23:47:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 326 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-04-27 17:01:18
合計ジャッジ時間 3,840 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 26 ms
10,496 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 25 ms
10,624 KB
testcase_06 AC 27 ms
10,624 KB
testcase_07 AC 25 ms
10,624 KB
testcase_08 AC 25 ms
10,496 KB
testcase_09 AC 25 ms
10,624 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 28 ms
10,752 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 TLE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 25 ms
10,624 KB
testcase_24 AC 26 ms
10,624 KB
testcase_25 AC 25 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def fact(n):
    if n == 0: return 1
    return n * fact(n-1)

def solve():
    S = input()
    ans = 0
    for i in range(len(S)-2):
        if S[i] == 'c':
            w_count = S[i+1:].count('w')
            if w_count >= 2:
                ans += fact(w_count) / fact(2) / fact(w_count -2 )
    print('%d' % ans)


solve()
0