TEST

test1

测试

test2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void printf_subset(int s){  //二进制状态下输出有1的位置下标
for(int i = 0;i < n;i++){
if(s & (1 << i))printf("%d ",i);
}
printf("\n");
}
void Comb(int k){ //枚举{0,...,n-1}中数量为k的子集
int comb = (1 << k) - 1;
while (comb < 1 << n) {
printf_subset(comb);
int x = comb & -comb, y = comb + x;
comb = ((comb&~y) / x >> 1) | y;
}
}