链接:传送门
题意:一个数n有多少种拆分方法
思路:典型母函数在整数拆分上的应用
/*************************************************************************
> File Name: 1.cpp
> Author: WArobot
> Blog: http://www.cnblogs.com/WArobot/
> Created Time: 2017年04月20日 星期四 21时07分09秒
************************************************************************/
#include<bits/stdc++.h>
using namespace std;
int p[130] , a[130] , b[130];
int n;
void init(){
for(int N = 1;N<=120;N++){
for(int i=0;i<=N;i++) a[i] = 1 , b[i] = 0;
for(int i=2;i<=N;i++){
for(int j=0;j<=N;j++)
for(int k=0;k*i+j<=N;k++) b[k*i+j] += a[j];
for(int j=0;j<=N;j++) a[j] = b[j] , b[j] = 0;
}
}
}
int main(){
init();
while(scanf("%d",&n)!=EOF && n){
printf("%d
",a[n]);
}
return 0;
}