69,373
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main()
{
int a[3] = {1,2,3}, b[3] = {0};
int i, j;
for(i = 0; i < 7; i++) // 2^n-1
{
b[0]++;
j = 0;
while (b[j] > 1 )
{
b[j] = 0;
j++;
b[j]++;
}
for (j = 0; j < 3; j++)
{
if (b[j])
printf("%d ", a[j]);
}
printf("\n");
}
return 0;
}