結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-02 10:24:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 480 bytes |
| コンパイル時間 | 3,428 ms |
| コンパイル使用メモリ | 246,512 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-02 10:25:02 |
| 合計ジャッジ時間 | 4,621 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i)
#define all(a) (a).begin(), (a).end()
int main() {
cin.tie(nullptr);
string S;
cin >> S;
int siz = S.size();
vector<ll> dp(3, 0);
rep(i, 0, siz) {
if (S[i] == 'c') dp[0]++;
if (S[i] == 'w') {
dp[2] += dp[1];
dp[1] += dp[0];
}
}
cout << dp[2] << '\n';
}