結果

問題 No.346 チワワ数え上げ問題
ユーザー pluto77pluto77
提出日時 2016-02-28 16:10:03
言語 Python2
(2.7.18)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 7,084 KB
実行使用メモリ 10,252 KB
最終ジャッジ日時 2023-10-24 18:45:49
合計ジャッジ時間 1,590 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,420 KB
testcase_01 AC 10 ms
6,420 KB
testcase_02 AC 9 ms
6,420 KB
testcase_03 AC 9 ms
6,420 KB
testcase_04 AC 10 ms
6,420 KB
testcase_05 AC 10 ms
6,420 KB
testcase_06 AC 11 ms
6,420 KB
testcase_07 AC 10 ms
6,420 KB
testcase_08 AC 11 ms
6,420 KB
testcase_09 AC 10 ms
6,420 KB
testcase_10 AC 55 ms
9,984 KB
testcase_11 AC 36 ms
8,564 KB
testcase_12 AC 43 ms
9,232 KB
testcase_13 AC 33 ms
8,244 KB
testcase_14 AC 11 ms
6,480 KB
testcase_15 AC 41 ms
8,920 KB
testcase_16 AC 46 ms
9,316 KB
testcase_17 AC 54 ms
10,076 KB
testcase_18 AC 55 ms
9,984 KB
testcase_19 AC 47 ms
9,608 KB
testcase_20 AC 75 ms
7,880 KB
testcase_21 AC 70 ms
10,252 KB
testcase_22 AC 70 ms
10,252 KB
testcase_23 AC 10 ms
6,420 KB
testcase_24 AC 9 ms
6,420 KB
testcase_25 AC 9 ms
6,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
##yuki_346

def combi(n):
 return n*(n-1)/2

s=list(raw_input())
n=len(s)

sw=[0 for i in xrange(n+1)]
for i in xrange(n-1,-1,-1):
 sw[i]+=sw[i+1]
 if s[i]=='w':
  sw[i]+=1

res=0
for i in xrange(n-1):
 if s[i]=='c':
  res+=combi(sw[i+1])

print res
0