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 |
纯stl, 1500MS#include <iostream> #include <stdio.h> #include <string> #include <map> using namespace std; string str1, str2; map<string, string> m; char str[100], c_str1[50], c_str2[50]; int main() { while(gets(str) && str[0] != '\0') { sscanf(str, "%s %s", c_str1, c_str2); str1.assign(c_str1); str2.assign(c_str2); m[str2] = str1; } while(scanf("%s", str) != EOF) { str1.assign(str); map<string, string>::iterator ret = m.find(str1); if(ret == m.end()) puts("eh"); else puts((*ret).second.c_str()); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator