#include <iostream>
using namespace std;
const int _max = 10001;
int c1[_max], c2[_max];
int main()
{
int nNum;
int i, j, k;
while(cin >> nNum)
{
for(i=0; i<=nNum; ++i)
{
c1[i] = 1;
c2[i] = 0;
}
for(i=2; i<=nNum; ++i)
{
for(j=0; j<=nNum; ++j)
for(k=0; k+j<=nNum; k+=i)
{
c2[j+k] += c1[j];
}
for(j=0; j<=nNum; ++j)
{
c1[j] = c2[j];
c2[j] = 0;
}
}
cout << c1[nNum] << endl;
}
return 0;
}
HDU1028 (母函数模板)
最新推荐文章于 2022-02-25 19:38:17 发布