結果

問題 No.346 チワワ数え上げ問題
ユーザー kyuna
提出日時 2019-08-20 19:14:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 71,144 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 16:01:52
合計ジャッジ時間 1,342 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    string s; cin >> s;
    vector<long long> dp(3);
    for (char c: s) {
        if (c == 'c') dp[0]++;
        if (c == 'w') dp[2] += dp[1], dp[1] += dp[0];
    }
    cout << dp[2] << endl;
    return 0;
}
0