結果

問題 No.346 チワワ数え上げ問題
ユーザー roiti46roiti46
提出日時 2016-02-26 22:33:03
言語 Python2
(2.7.18)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 7,080 KB
実行使用メモリ 11,500 KB
最終ジャッジ日時 2023-10-23 20:31:53
合計ジャッジ時間 2,457 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
8,328 KB
testcase_01 AC 22 ms
8,328 KB
testcase_02 AC 23 ms
8,328 KB
testcase_03 AC 23 ms
8,328 KB
testcase_04 AC 22 ms
8,328 KB
testcase_05 AC 22 ms
8,328 KB
testcase_06 AC 22 ms
8,328 KB
testcase_07 AC 22 ms
8,328 KB
testcase_08 AC 23 ms
8,328 KB
testcase_09 AC 23 ms
8,328 KB
testcase_10 AC 45 ms
8,656 KB
testcase_11 AC 36 ms
8,484 KB
testcase_12 AC 40 ms
8,592 KB
testcase_13 AC 34 ms
8,476 KB
testcase_14 AC 22 ms
8,328 KB
testcase_15 AC 39 ms
8,564 KB
testcase_16 AC 41 ms
8,604 KB
testcase_17 AC 44 ms
8,656 KB
testcase_18 AC 43 ms
8,656 KB
testcase_19 AC 42 ms
8,636 KB
testcase_20 AC 52 ms
11,492 KB
testcase_21 AC 106 ms
11,500 KB
testcase_22 AC 108 ms
11,500 KB
testcase_23 AC 23 ms
8,328 KB
testcase_24 AC 24 ms
8,328 KB
testcase_25 AC 23 ms
8,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

s = raw_input()

c = []
w = []
for i, si in enumerate(s):
    if si == "c":
        c.append(i)
    if si == "w":
        w.append(i)

ans = 0 
for i in c:
    j = bisect.bisect_right(w, i)
    if j >= len(w) - 1: break
    ans += (len(w) - j - 1)*(len(w) - j)/2
print ans
0