mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1028.cpp
This commit is contained in:
parent
9dc0698116
commit
49cbc2ed2e
36
HDOJ/1028.cpp
Normal file
36
HDOJ/1028.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user