Create 1028.cpp

This commit is contained in:
Kirigaya Kazuto 2016-07-21 10:42:38 +08:00 committed by GitHub
parent 9dc0698116
commit 49cbc2ed2e

36
HDOJ/1028.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <iostream>
using namespace std;
#define MAXN 128
int c[MAXN];
int d[MAXN];
int main()
{
int N;
while(cin>>N)
{
for(int i=0;i<=N;i++)
{
c[i]=1;
d[i]=0;
}
for(int i=2;i<=N;i++)
{
for(int j=0;j<=N;j++)
{
for(int k=0;k+j<=N;k+=i)
{
d[j+k] += c[j];
}
}
for(int j=0;j<=N; ++j)
{
c[j] = d[j];
d[j] = 0;
}
}
cout<<c[N]<<endl;
}
return 0;
}