結果

問題 No.346 チワワ数え上げ問題
ユーザー cocolleague
提出日時 2017-01-29 01:57:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 1,368 ms
コンパイル使用メモリ 158,060 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 22:34:27
合計ジャッジ時間 2,296 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 3 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void){
	string S;
	cin >> S;
	long long  ans = 0;
	long long   w = 0;
	for(unsigned int i = 0;i<S.length();i++){
		if(S[i] == 'w') w++;
        if(S[i] == 'c') ans += w * (w-1) / 2;
    	}
    	cout << ans << endl;
    	return 0;	
    }

0