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 |
下面这样为什么过不了#include <iostream> #include <string> using namespace std; int arry[14]; int main() { int n; cin>>n; while(n--) { memset(arry,0,sizeof(arry)); for(int i=0;i<3;++i) { string str1,str2,str3; cin>>str1>>str2>>str3; int len1=0; len1=str1.length(); if(str3=="even") { for(int j=0;j<len1;++j) arry[str1[j]-65]=2; for(int k=0;k<len1;++k) arry[str2[k]-65]=2; } if(str3=="up") { for(int j=0;j<len1;++j) { if(arry[str1[j]-65]!=2) arry[str1[j]-65]=-1; } for(int k=0;k<len1;++k) { if(arry[str2[k]-65]!=2) arry[str2[k]-65]=1; } } if(str3=="down") { for(int j=0;j<len1;++j) { if(arry[str1[j]-65]!=2) arry[str1[j]-65]=1; } for(int k=0;k<len1;++k) { if(arry[str2[k]-65]!=2) arry[str2[k]-65]=-1; } } } for(int t=0;t<12;++t) { if(arry[t]==-1) { cout<<(char)(t+65)<<" is the counterfeit coin and it is heavy."<<endl; break; } else if(arry[t]==1) { cout<<(char)(t+65)<<" 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