結果

問題 No.346 チワワ数え上げ問題
ユーザー fiordfiord
提出日時 2016-02-26 22:56:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 1,438 ms
コンパイル使用メモリ 160,040 KB
実行使用メモリ 5,336 KB
最終ジャッジ日時 2023-10-24 05:45:34
合計ジャッジ時間 2,543 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,208 KB
testcase_01 AC 3 ms
5,208 KB
testcase_02 AC 3 ms
5,204 KB
testcase_03 AC 3 ms
5,208 KB
testcase_04 AC 3 ms
5,208 KB
testcase_05 AC 3 ms
5,204 KB
testcase_06 AC 3 ms
5,208 KB
testcase_07 AC 3 ms
5,208 KB
testcase_08 AC 3 ms
5,208 KB
testcase_09 AC 3 ms
5,208 KB
testcase_10 WA -
testcase_11 AC 4 ms
5,320 KB
testcase_12 WA -
testcase_13 AC 4 ms
5,316 KB
testcase_14 AC 3 ms
5,216 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 5 ms
5,336 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 3 ms
5,204 KB
testcase_24 AC 3 ms
5,204 KB
testcase_25 AC 3 ms
5,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;	cin>>s;
	int n=s.size();
	int dp[4][100010];	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		if(s[i]=='c'){
			dp[1][i+1]+=dp[0][i];
		}
		else if(s[i]=='w'){
			dp[2][i+1]+=dp[1][i];
			dp[3][i+1]+=dp[2][i];
		}
		for(int j=0;j<4;j++)	dp[j][i+1]+=dp[j][i];
	}
	cout<<dp[3][n]<<endl;
	return 0;
}
0