A、B、C、D、E、F、G、H、I、J
请编程根据这些条件判断这10名同学中参赛者名单。如果有多种可能,则输出所有的可能情况。每种情况占一行。参赛同学按字母升序排列,用空格分隔。
比如:
C
就是一种可能的情况。
- #include
- using
namespace std; - bool
judge( int*x){ -
boola1= x[0]==0 || x[1]==1; -
boola2= x[2]==1 || x[3]==0; -
boola3= x[0] * x[2]<1; -
boola4= x[1] + x[3]==1; -
boola5= x[3] + x[4] + x[5] + x[6] + x[7]>=2; -
boola6= (x[2] + x[6]==0)||(x[2] + x[6]==2); -
boola7= x[2] + x[4] + x[6] + x[8]<=2; -
boola8= x[4]==0 || (x[5]&&x[6]); -
boola9= x[5]==0 || (x[6]==0 && x[7]==0); -
boola10= x[8]==1 || x[9]==1 || x[7]==1; -
returna1&&a2&&a3&&a4&&a5&&a6&&a7&&a8&&a8&&a9&&a10; -
}
- int
main(){ - char
ch[]= "ABCDEFGHIJ"; -
intx[]={0,0,0,0,0,0,0,0,0,0}; -
for(x[0]=0;x[0]<2;x[0]++) -
for(x[1]=0;x[1]<2;x[1]++) -
for(x[2]=0;x[2]<2;x[2]++) -
for(x[3]=0;x[3]<2;x[3]++) -
for(x[4]=0;x[4]<2;x[4]++) -
for(x[5]=0;x[5]<2;x[5]++) -
for(x[6]=0;x[6]<2;x[6]++) -
for(x[7]=0;x[7]<2;x[7]++) -
for(x[8]=0;x[8]<2;x[8]++) -
for(x[9]=0;x[9]<2;x[9]++) -
if(judge(x)){//outputdata -
for(int i=0;i<10;i++) -
if(x[i]==1)cout<<ch[i]<< "" ; -
cout<<endl; -
} - return
0; -
}