题目描述
给定一个正整数,我们可以定义出下面的公式:
N=a[1]+a[2]+a[3]+…+a[m];
a[i]>0,1<=m<=N;
对于一个正整数,求解满足上面公式的所有算式组合,如,对于整数 4 :
4 = 4;
4 = 3 + 1;
4 = 2 + 2;
4 = 2 + 1 + 1;
4 = 1 + 1 + 1 + 1;
所以上面的结果是 5 。
注意:对于 “4 = 3 + 1” 和 “4 = 1 + 3” ,这两处算式实际上是同一个组合!
int main()
{
// please define the C++ input here. For example: int a,b; cin>>a>>b;;
// please finish the function body here.
// please define the C++ output here. For example:cout<<____<<endl;
int n[121][121]={
0};
n[1][1]=1;
n[2][1]=1;
n[2][2]=2;
n[3][1]=1;
n[3][2]=2;
n[3][3