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> #include <algorithm> using namespace std; int main() { string str1[100],str2[100],str3[100];//,str4[100]; int a,b; //while(true) //{ int i=0; while(cin>>str1[i]&&str1[i]!="XXXXXX") { /*str2[i]=str1[i]; sort(&str2[i][0],&str2[i][0]+str1[i].length());*/ i++; } sort(&str1[0],&str1[0]+i); for(int k=0;k<i;k++) str2[k]=str1[k]; for(int j=0;j<i;j++) sort(&str1[j][0],&str1[j][0]+str1[j].length()); a=i; i=0; while(cin>>str3[i]&&str3[i]!="XXXXXX") { sort(&str3[i][0],&str3[i][0]+str3[i].length()); i++; } b=i; for(j=0;j<b;j++) { bool match=true; for(int k=0;k<a;k++) { if(str1[k]==str3[j]) { cout<<str2[k]<<endl; match=false; } } if(match) cout<<"NOT A VALID WORD"<<endl; cout<<"******"<<endl; } /*b=i; for(int j=0;j<b;j++) { int m=0; bool exist=false; for(int k=0;k<a;k++) { if(str3[i]==str2[k]) { str4[m]=str1[k]; m++; exist=true; } } if(exist) { sort(str4,str4+m); for(int n=0;n<m;n++) cout<<str4[n]<<endl; } else cout<<"NOT A VALID WORD"<<endl; cout<<"******"<<endl; }*/ //} return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator