結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
kyo1
|
| 提出日時 | 2020-07-08 00:28:20 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 370 bytes |
| 記録 | |
| コンパイル時間 | 1,758 ms |
| コンパイル使用メモリ | 214,260 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-11 05:37:34 |
| 合計ジャッジ時間 | 2,504 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string S;
cin >> S;
int64_t w = 0;
for (auto s : S) {
if (s == 'w') w++;
}
int64_t res = 0;
for (auto s : S) {
if (s == 'c') {
res += w * (w - 1) / 2;
} else if (s == 'w') {
w--;
}
}
cout << res << '\n';
return 0;
}
kyo1