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 |
正确答案In Reply To:最傻瓜的思路~~可是..还是wa.,... Posted by:joyan at 2007-03-03 14:39:59 > #include<iostream.h> > #include<string.h> > > int main(){ > char szLeft[3][12],szRight[3][12],szResult[3][7]; > char cNow; > int n,i,j; > cin>>n; > for( i = 0; i < n; i++){ > for( j = 0; j < 3 ;j++){ > cin>>szLeft[j]>>szRight[j]>>szResult[j]; > } > for(cNow = 'A'; cNow <= 'L'; cNow++){ > for( j = 0; j < 3 ;j++){ > if(szResult[j][0] == 'u' && !strchr(szLeft[j],cNow)) break; > if(szResult[j][0] == 'd' && !strchr(szRight[j],cNow)) break; > if(szResult[j][0] == 'e' > && (strchr(szLeft[j],cNow) ||strchr(szRight[j],cNow))) break; > } > if(j == 3){ > cout<<cNow<<" is the counterfeit coin and it is heavy."<<endl; > break; > } > for( j = 0; j < 3 ;j++){ > if(szResult[j][0] == 'd' && !strchr(szLeft[j],cNow)) break; > if(szResult[j][0] == 'u' && !strchr(szRight[j],cNow)) break; > if(szResult[j][0] == 'e' > && (strchr(szLeft[j],cNow) ||strchr(szRight[j],cNow))) break; > } > if(j == 3){ > cout<<cNow<<" is the counterfeit coin and it is light."<<endl; > break; > } > } > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator