poj1013
#include <iostream>#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
char left[3][5];
char right[3][5];
char status[3][5];
int n;
cin>>n;
getchar();
while(n--)
{
int i;
for(i=0;i<3;i++)
{
scanf("%s",left[i]);
scanf("%s",right[i]);
gets(status[i]);
}
int x;
int t;
for(x='A';x<='L';x++)
{
int wl=0;
int wr=0;
int j;
int tag;
int flag[3][3]={0};
for(i=0;i<3;i++)
{
if(status[i][0]=='e')
tag=0;
else if(status[i][0]=='u')
tag=1;
else
tag=-1;
t=0;
while(t<=2)
{
for(j=0;j<4;j++)
{
if(x==left[i][j])
wl+=t;
else
wl++;
}
for(j=0;j<4;j++)
{
if(x==right[i][j])
wr+=t;
else
wr++;
}
if((wl-wr)==tag)
flag[t][i]=1;
t+=2;
wl=0;
wr=0;
}
}
bool print=0;
for(j=0;j<=2;j+=2)
if(flag[j][0]==1&&flag[j][1]==1&&flag[j][2]==1)
{
if(j==0)
printf("%c is the counterfeit coin and it is light.",x);
else
printf("%c is the counterfeit coin and it is heavy.",x);
cout<<endl;
print=1;
}
if(print==1)
break;
}
}
return 0;
}
输不出正确答案,这是哪里有错