Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16918 Accepted Submission(s):
11907
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 int main() 6 { 7 int n,i,j,m; 8 int dp[125][125]; 9 memset(dp,0,sizeof(dp)); 10 dp[1][1]=1; 11 for(i=1; i<=120; i++) 12 { 13 dp[i][1]=1; 14 dp[1][i]=1; 15 } 16 for(i=2; i<=120; i++) //规律可见推荐的博客~ 17 { 18 for(j=2; j<=120; j++) 19 { 20 if(j>i) 21 dp[i][j]=dp[i][i]; 22 else if(i==j) 23 dp[i][j]=dp[i][j-1]+1; 24 else 25 dp[i][j]=dp[i][j-1]+dp[i-j][j]; 26 } 27 } 28 while(~scanf("%d",&n)) 29 { 30 printf("%d\n",dp[n][n]); 31 } 32 return 0; 33 }
hdu 1028 Ignatius and the Princess III
原文:http://www.cnblogs.com/pshw/p/5242371.html