Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为啥老是提交不过,删除一些注释代码后就过了呢?

Posted by xcl119xcl at 2007-07-25 21:20:54 on Problem 1318
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator