poj 2503 (map)
很慢。。但是很简单。学习了。
1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <map> 5 #include <string> 6 #include <cstring> 7 8 using namespace std; 9 10 int main() 11 { 12 char str[20],s1[20],s2[20]; 13 map<string,string>mymap; 14 while(gets(str)) 15 { 16 if(strlen(str)==0) break; 17 sscanf(str,"%s %s",s1,s2); 18 mymap[s2]=s1; 19 } 20 while(gets(str)) 21 { 22 //cout<<str<<endl; 23 //sscanf(str,"%s",s2); 24 if(mymap[str].length()==0) 25 puts("eh"); 26 else 27 cout<<mymap[str]<<endl; 28 } 29 return 0; 30 }