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

都用的cin,c++过了,G++超时了,附代码

Posted by 1004115224 at 2012-08-21 21:25:02 on Problem 2503
#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:
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