結果
| 問題 | 
                            No.346 チワワ数え上げ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-07-19 22:58:38 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 321 bytes | 
| コンパイル時間 | 1,773 ms | 
| コンパイル使用メモリ | 167,020 KB | 
| 実行使用メモリ | 13,636 KB | 
| 最終ジャッジ日時 | 2024-12-17 17:04:35 | 
| 合計ジャッジ時間 | 10,151 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 WA * 9 TLE * 1 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
int main(){
	string s; cin>>s;
	int n=s.size();
	
	int ans=0;
	rep(i,n){
		int cnt=0;
		if(s[i]=='c'){
			for(int j=i; j<n; j++){
				if(s[j]=='w') cnt++;
			}
		}
		ans+=(cnt*(cnt-1))/2;
	}
	cout<<ans<<endl;
}