回覆列表
-
1 # 使用者5084128254846
-
2 # 使用者5084128254846
#include
int a[5];
int len1,len2,len3;
void input(int len1,int len2,int len3)
{
printf("%d %d %d\n",a[len1],a[len2],a[len3]);
}
void solve(int len1,int len2,int len3)
{
input(len1,len2,len3);
if(len1==2) return;
if(len3
else if(len2
{
len2++;
len3=len2+1;
}
else if(len1
{
len1++;
len2=len1+1;
len3=len2+1;
}
solve(len1,len2,len3);
}
void main()
{
int i;
for(i=0;i
printf("所構成組合是:\n");
solve(0,1,2);
return ;
}
#include
int a[5];
int len1,len2,len3;
void input(int len1,int len2,int len3)
{
printf("%d %d %d\n",a[len1],a[len2],a[len3]);
}
void solve(int len1,int len2,int len3)
{
input(len1,len2,len3);
if(len1==2) return;
if(len3
else if(len2
{
len2++;
len3=len2+1;
}
else if(len1
{
len1++;
len2=len1+1;
len3=len2+1;
}
solve(len1,len2,len3);
}
void main()
{
int i;
for(i=0;i
printf("所構成組合是:\n");
solve(0,1,2);
return ;
}