結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-26 22:34:51 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1,211 ms / 2,000 ms |
| + 58µs | |
| コード長 | 333 bytes |
| 記録 | |
| コンパイル時間 | 329 ms |
| コンパイル使用メモリ | 77,044 KB |
| 実行使用メモリ | 9,712 KB |
| 最終ジャッジ日時 | 2026-09-02 12:45:31 |
| 合計ジャッジ時間 | 4,652 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
long long ans = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] != 'c') {
continue;
}
long long nw = count(s.begin() + i, s.end(), 'w');
ans += nw * (nw - 1) / 2;
}
cout << ans << endl;
return 0;
}