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

0ms。。。。

Posted by wyylling at 2009-10-22 23:12:10 on Problem 1318
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<numeric>
#include<cmath>
#include<bitset>
#include<set>
#include<queue>
#include<iterator>
#include<limits>
#include<map>

using namespace std;

int main(int argc, char* argv[])
{
	map<string,string> dictionary;
	string str,tmp;
	bool flag;
	string s1 = "******";
	map<string,string>::iterator it;
	while(cin>>str)
	{
		if(str == "XXXXXX")
			break;
		tmp = str;
		sort(tmp.begin(),tmp.end());
		dictionary.insert(make_pair(str,tmp));
	}
	
	while(cin>>str)
	{
		if(str == "XXXXXX")
			break;
		sort(str.begin(),str.end());
		//it = dictionary.find(str);
		//if(it != dictionary.end())
		flag = false;
		for(it = dictionary.begin(); it != dictionary.end(); ++it)
		{
			if(it->second == str)
			{
				flag = true;
				cout<<it->first<<endl;
			}
		}
		if(flag == true)
		{
			cout<<s1<<endl;
		}
		else
		{
			cout<<"NOT A VALID WORD"<<endl;
			cout<<s1<<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