const int N = 125;
ll a[N+1], b[N+1];//b临时数组
void x_x()
{
a[0] = 1;
f(i, 1, N)//枚举1`N每一个数的母函数
{
for (int j = 0;j <= N;j += i)//取出每一个数的母函数的每一个数
{
for (int k = 0;k + j <= N;k++)//系数更新
b[k + j] += a[k];
}
f(j, 1, N)
{
a[j] = b[j];
b[j] = 0;
}
}
}
int main()
{
//freopen("in.txt", "r", stdin);
int n;
x_x();
while (cin >> n)
{
printf("%lld\n", a[n]);
}
return 0;
}
Ignatius and the Princess III HDU - 1028(母函数)
最新推荐文章于 2021-03-02 19:40:37 发布