結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
|
提出日時 | 2016-02-28 16:10:03 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 265 bytes |
コンパイル時間 | 53 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2024-09-24 12:05:08 |
合計ジャッジ時間 | 1,918 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#coding: utf-8##yuki_346def combi(n):return n*(n-1)/2s=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]+=1res=0for i in xrange(n-1):if s[i]=='c':res+=combi(sw[i+1])print res