| ||||||||||
| 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 | |||||||||
都用的cin,c++过了,G++超时了,附代码#include<iostream>
#include<map>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
map<string,string>p;
string a,b;
while(cin>>a)
{
if(getchar()=='\n')break;
cin>>b;
p[b]=a;
}
if(p[a]=="")cout<<"eh"<<endl;
else cout<<p[a]<<endl;
while(cin>>a)
{
if(p[a]=="")cout<<"eh"<<endl;
else cout<<p[a]<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator