标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)4 10 20
5 42 627
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<vector>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<climits>
#include<list>
#include<iomanip>
#include<stack>
#include<set>
using namespace std;
int dp[200][200];
int dfs(int a,int b)
{
if(dp[a][b]!=-1)
return dp[a][b];
if(b==1)
return dp[a][b]=1;
if(a<b)
return dp[a][b]=dfs(a,a);
if(a==b)
return dp[a][b]=dfs(a,b-1)+1;
return dp[a][b]=dfs(a,b-1)+dfs(a-b,b);
}
int main()
{
int n;
while(cin>>n)
{
memset(dp,-1,sizeof(dp));
cout<<dfs(n,n)<<endl;
}
}hdu1028Ignatius and the Princess III
标签:
原文地址:http://blog.csdn.net/stl112514/article/details/45046827