这是前几天写的深搜题目
#include<bits/stdc++.h>
using namespace std;
int a[
1000]={
1},n;
int CJ(
int,
int);
int JF(
int);
int main()
{
cin>>
n;
CJ(n,1);
return 0;
}
int CJ(
int x,
int t)
{
int i;
for(i=a[t-
1];i<=x;i++
)
if(i<
n)
{
a[t]=
i;
x-=
i;
if(x==
0)
JF(t);
else
CJ(x,t+
1);
x+=
i;
}
}
int JF(
int t)
{
for(
int i=
1;i<=t-
1;i++
)
{
cout<<a[i]<<
"+";
}
cout<<a[t]<<
"\n";
}
转载于:https://www.cnblogs.com/5t2y0/p/9464876.html
转载请注明原文地址: https://win8.8miu.com/read-26919.html