Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
AC (/≧▽≦)/#include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #include<string.h> #include<map> #include<math.h> #include<vector> #include<queue> #include<stack> #define inf 99999999 using namespace std; int t; struct node { string l,r,res; }n[4]; string s0[2]={"down","up"},s1[2]={"up","down"}; string s[2]={" is the counterfeit coin and it is light."," is the counterfeit coin and it is heavy."}; bool ok(char x,int y)//0轻1重 { for(int i=1;i<=3;i++) { int lf=n[i].l.find(x),rf=n[i].r.find(x); if(lf!=-1&&rf==-1) { if(n[i].res!=s0[y])return 0; } else if(lf==-1&&rf!=-1) { if(n[i].res!=s1[y])return 0; } else { if(n[i].res!="even")return 0; } } return 1; } int main() { cin>>t; while(t--) { for(int i=1;i<=3;i++) cin>>n[i].l>>n[i].r>>n[i].res; for(int i='A';i<='L';i++)//枚举12枚假币 for(int j=0;j<=1;j++)//0轻1重 if(ok(i,j))cout<<(char)i<<s[j]<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator