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

map写着很happy呀……

Posted by anyl94xh at 2011-10-20 15:50:26 on Problem 2503
//除了时间有点……
#include<iostream>
#include<string>
#include<map>
using namespace std;
map<string,string> rule;
int main()
{
	int cur,len;
	string s,s1,s2;
	while(getline(cin,s))
	{
		if((cur=s.find(' '))!=string::npos)
		{
			len=s.length();
			s1=s.substr(0,cur);
			s2=s.substr(cur+1,len);
			rule[s2]=s1;
		}
		else
		{
			if(s=="") continue;
			if(rule[s]!="") cout<<rule[s]<<endl;
			else cout<<"eh\n";
		}
	}
	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