POJ 1013

1189阅读 0评论2010-03-10 renqingwei123
分类:

就是一个个地试,总会有结果的。
 
#include
#include
using namespace std;
struct node
{
 char fir[20];
 char sec[20];
 char comppent[20];
};
bool check(node temp,char sign,int weight)
{
 int left,right,i,strlength;
 left=right=0;
 strlength=strlen(temp.fir);
 for(i=0;i {
  if(temp.fir[i]!=sign)
  {
   left+=0;
  }
  if(temp.fir[i]==sign)
  {
   left+=weight;
  }
  if(temp.sec[i]!=sign)
  {
   right+=0;
  }
  if(temp.sec[i]==sign)
  {
   right+=weight;
  }
 }
 if(temp.comppent[0]=='e'&&(left==right))
 {
  return true;
 }
 if(temp.comppent[0]=='u'&&(left>right))
 {
  return true;
 }
 if(temp.comppent[0]=='d'&&(left {
  return true;
 }
 return false;
}

int main()
{
 int N,i,j,left,right;
 char alph[12];
 bool good;
 int weight=0;
 for(i=0;i<12;i++)
 {
  alph[i]=(char)('A'+i);
 }
 node test[3];
 cin>>N;
 while(N--)
 {
  for(i=0;i<3;i++)
  {
   cin>>test[i].fir;
   cin>>test[i].sec;
   cin>>test[i].comppent;
  }
  weight=-1; //light
  for(j=0;j<12;j++)
  {
   good=true;
   left=right=0;
   for(i=0;i<3;i++)
   {
    if(check(test[i],alph[j],weight))
    {
    }
    else
    {
     good=false;
    }
   }
   if(good==true) 
   {
    cout<   }
  }
  weight=1; //weight
  for(j=0;j<12;j++)
  {
   good=true;
   left=right=0;
   for(i=0;i<3;i++)
   {
    if(check(test[i],alph[j],weight))
    {
    }
    else
    {
     good=false;
    }
   }
   if(good==true)
   {
    cout<   }
  }
 }
 return 0;
}
上一篇:没有了
下一篇:POJ 1014