結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
19,272 KB
testcase_01 AC 14 ms
19,272 KB
testcase_02 AC 14 ms
19,268 KB
testcase_03 AC 14 ms
19,272 KB
testcase_04 AC 14 ms
19,272 KB
testcase_05 AC 14 ms
19,268 KB
testcase_06 AC 13 ms
19,272 KB
testcase_07 AC 14 ms
19,272 KB
testcase_08 AC 14 ms
19,272 KB
testcase_09 AC 14 ms
19,272 KB
testcase_10 WA -
testcase_11 AC 15 ms
19,384 KB
testcase_12 WA -
testcase_13 AC 15 ms
19,380 KB
testcase_14 AC 13 ms
19,280 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 16 ms
19,400 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 14 ms
19,268 KB
testcase_24 AC 14 ms
19,268 KB
testcase_25 AC 16 ms
19,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;	cin>>s;
	int n=s.size();
	int dp[4][1000010];	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