結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
progressing7
|
| 提出日時 | 2016-02-27 20:12:28 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 377 bytes |
| 記録 | |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 77,160 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-11 16:48:57 |
| 合計ジャッジ時間 | 2,807 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 9 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string s; cin >> s;
auto cit = find(s.begin(), s.end(),'c');
int ans = 0;
while (true) {
int wcnt = count(cit, s.end(), 'w');
if (wcnt != 0) {
ans += (wcnt*(wcnt - 1) / 2);
cit = find(cit + 1, s.end(), 'c');
} else {
break;
}
}
cout << ans << endl;
return 0;
}
progressing7