例:N=2 (true,true),(false,true),(true,false),(false,false)
#include<stdio.h>
int count=0;
void perm(char *list,int n,int i);
int main(void)
{
size_t n;
printf("Enter the size:\n");
scanf("%d",&n);
char Bool[n+1];
Bool[n-1]='\0';
perm(Bool,n,1);
printf("\n %d",count);
return 0;
}
void perm(char *Bool,int n,int i)
{
count++;
if(i==n)
{
Bool[i-1]='T';
printf("%s\n",Bool);
Bool[i-1]='F';
printf("%s\n",Bool);
count+=4;
}
else
{
count++;
Bool[i-1]='T';
count++;
perm(Bool,n,i+1);
count++;
Bool[i-1]='F';
count++;
perm(Bool,n,i+1);
}
}