結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
data9824
|
| 提出日時 | 2016-04-07 00:27:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 338 bytes |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 55,132 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-04 02:24:33 |
| 合計ジャッジ時間 | 1,323 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int wCount = 0;
long long result = 0;
for (int i = s.size() - 1; i >= 0; --i) {
if (s[i] == 'w') {
++wCount;
}
if (s[i] == 'c' && wCount >= 2) {
result += wCount * (wCount - 1) / 2;
}
}
cout << result << endl;
return 0;
}
data9824