Create 1284_cnblogs.cpp

From http://www.cnblogs.com/qiufeihai/archive/2012/09/11/2680840.html
This commit is contained in:
KiritoTRw 2016-05-07 19:51:40 +08:00
parent feb6ba9c06
commit 432f364971

28
HDOJ/1284_cnblogs.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
const int M = 32768 + 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 <= 3; i++)
{
for (int j = 1; j <= n; j++)
{
dp[j] += dp[j - i];
}
}
printf("%d\n", dp[n]);
}
return 0;
}