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

help!!!

Posted by osama86 at 2006-07-17 02:38:06 on Problem 2872
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef vector <string> stringVec;
typedef vector <stringVec> three;

int main()
{
	int d;
	cin>>d;
	vector <string> ini;//(26);
	vector <stringVec> ini2(27,ini);
	vector <three> dic(26,ini2);//3d ARRAY!!!! 
	string read;
	for (int i=0;i<d;i++)
	{
		cin>>read;
		if (read.size()>1)
			dic[int(read[0])-'a'][int(read[1])-'a'].push_back(read);
		else
			dic[int(read[0])-'a'][26].push_back(read);
	}

	
	int e;
	cin>>e;
	
	for (int c=1;c<=e;c++)
	{
		int wrong=0;
		while (1)
		{
			cin>>read;
			if (read=="-1")
			{
				break;
			}
			if (read.length()>1)
				for (i=0;i<dic[int(read[0])-'a'][int(read[1])-'a'].size();i++)
					if (read==dic[int(read[0])-'a'][int(read[1])-'a'][i])
						break;
			else
				for (i=0;i<dic[int(read[0])-'a'][26].size();i++)
					if (read==dic[int(read[0])-'a'][26][i])
						break;
			if (i==dic[int(read[0])-'a'][int(read[1])-'a'].size() || i==dic[int(read[0])-'a'][26].size())
			{
				
				wrong++;//.push_back(read);
				if (wrong==1)
					cout<<"Email "<<c<<" is not spelled correctly."<<endl;
				cout<<read<<endl;
			}			
		}

		if (wrong==0)
			cout<<"Email "<<c<<" is spelled correctly."<<endl;			
	}
	cout<<"End of Output"<<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