結果

問題 No.346 チワワ数え上げ問題
ユーザー cocolleague
提出日時 2017-01-29 01:58:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 300 bytes
コンパイル時間 1,411 ms
コンパイル使用メモリ 157,268 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-12-23 22:39:31
合計ジャッジ時間 83,561 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 3
other TLE * 23
権限があれば一括ダウンロードができます

ソースコード

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 = S.length()-1 ;i >= 0;i--){
		if(S[i] == 'w') w++;
        if(S[i] == 'c') ans += w * (w-1) / 2;
    	}
    	cout << ans << endl;
    	return 0;	
    }

0