結果

問題 No.346 チワワ数え上げ問題
ユーザー kroton
提出日時 2016-02-27 07:14:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 60,352 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 11:17:34
合計ジャッジ時間 1,234 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int solve(const string& S, const string& target) {
	vector<int> dp(target.size() + 1, 0);
	dp[0] = 1;
	for(char c : S){
		for(int i=target.size()-1;i>=0;--i){
			if(c == target[i]){
				dp[i+1] += dp[i];
			}
		}
	}
	return dp.back();
}

int main(){
	string S;
	cin >> S;
	cout << solve(S, "cww") << endl;
	return 0;
}
0