| ||||||||||
| 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 | |||||||||
map写着很happy呀……//除了时间有点……
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator