結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2020-07-08 00:27:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 362 bytes |
コンパイル時間 | 2,755 ms |
コンパイル使用メモリ | 191,848 KB |
最終ジャッジ日時 | 2025-01-11 16:44:53 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string S; cin >> S; int w = 0; for (auto s : S) { if (s == 'w') w++; } int res = 0; for (auto s : S) { if (s == 'c') { res += w * (w - 1) / 2; } else if (s == 'w') { w--; } } cout << res << '\n'; return 0; }