#include <cstring>
#include <cstdio>
#include <iostream>
using namespace std;
long long dp[35][35];
long long fun(int n,int k){
if(dp[n][k]>=0){
return dp[n][k];
}
long long ans;
if(n==0){
if(k%2==0)
ans = 1;
else
ans = 0;
}
else
ans = fun(n-1,k+1)+fun(n-1,k)+fun(n-1,k);
dp[n][k]=ans;
return ans;
}
int main(){
int a;
while(cin>>a){
memset(dp,-1,sizeof dp);
cout<<fun(a,0)<<endl;
}
return 0;
}
K公好色【动态规划】
最新推荐文章于 2021-10-12 15:48:27 发布
1896

被折叠的 条评论
为什么被折叠?



