結果

問題 No.346 チワワ数え上げ問題
ユーザー willowoooo
提出日時 2016-05-15 22:05:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 305 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 60,152 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 04:08:53
合計ジャッジ時間 1,167 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

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