KiritoTRw 2016-05-07 19:53:53 +08:00
parent 432f364971
commit 1701104c48
1 changed files with 30 additions and 0 deletions

30
HDOJ/1028_cnblogs.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int M = 120 + 10;
int dp[M];
int main()
{
int n;
while (~scanf("%d", &n))
{
memset(dp, 0, sizeof(dp));
dp[0] = 1;
for (int i = 1; i <= n; i++)
{
for (int j = i; j <= n; j++)
{
dp[j] += dp[j - i];
}
}
printf("%d\n", dp[n]);
}
return 0;
}