結果

問題 No.346 チワワ数え上げ問題
ユーザー 👑 CleyL
提出日時 2020-02-12 02:08:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 66,032 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 15:25:59
合計ジャッジ時間 1,872 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int dp[100000][3];
int main(){
    string s;cin>>s;
    if(s[0] == 'c')dp[0][0] = 1;
    for(int i = 1; s.size() > i; i++){
        dp[i][0] = dp[i-1][0] + (s[i]=='c'?1:0);
        dp[i][1] = dp[i-1][1] + (s[i]=='w'?dp[i-1][0]:0);
        dp[i][2] = dp[i-1][2] + (s[i]=='w'?dp[i-1][1]:0);
    }
    cout << dp[s.size()-1][2] << endl;
}
0