結果

問題 No.346 チワワ数え上げ問題
ユーザー rodea
提出日時 2018-02-22 18:19:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 02:01:56
合計ジャッジ時間 1,790 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;

int main()
{
	string s;

	cin >> s;

	int count = 0, ans = 0;
	for (int i = s.size(); i >= 0; i--)
	{
		if (s[i] == 'w')
		{
			count++;
		}

		if (s[i] == 'c')
		{
			ans += count * (count - 1) / 2;
		}
	}
	cout << ans << endl;
}
0