标签:poj line def cout while substr std ++ bst
题目链接 http://poj.org/problem?id=2503
英文A <=> 方言B
输入B,求A
#include <iostream>
#include <string.h>
#include "map"
#include "string"
using namespace std;
typedef long long ll;
double eps = 1e-7;
map <string, string> m;
int main() {
ios::sync_with_stdio(false);
string s;
do{
getline(cin,s);
bool flag = false;
for(int i = 0;s[i];++i){
if(s[i] == ' '){
m[s.substr(i+1)] = s.substr(0,i);
break;
}
}
}while(s.length());
while(cin >> s){
if(m.find(s) != m.end()){
cout << m[s] << endl;
}else{
cout << "eh" << endl;
}
}
return 0;
}
【POJ 2503】Babelfish(水题)stl map存取即可
标签:poj line def cout while substr std ++ bst
原文地址:https://www.cnblogs.com/zhangjiuding/p/11476951.html