結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
kyo1
|
| 提出日時 | 2020-07-08 00:28:20 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 745µs | |
| コード長 | 370 bytes |
| 記録 | |
| コンパイル時間 | 1,192 ms |
| コンパイル使用メモリ | 214,324 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-29 16:52:45 |
| 合計ジャッジ時間 | 2,814 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#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