結果

問題 No.346 チワワ数え上げ問題
ユーザー LogicR_piman
提出日時 2016-10-07 23:58:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 56,572 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-21 19:59:38
合計ジャッジ時間 8,832 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 9 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main() {
	string s;
	int i = 0, j = 0, n, a = 0;
	long l;

	cin >> s;
	l = s.length();

	while (-1) {
		if (s[i] == 'c') {
			n = 0;
			for (j = i; j < l; j++) {
				if (s[j] == 'w') {
					n++;
				}
			}
			a = a + n*(n - 1) / 2;
		}
		else if (s[i] == '\0') {
			break;
		}
		i++;
	}

	cout << a << endl;

	return 0;
}
0