您的位置:首页 > 其它

Babelfish(poj 2503)

2016-06-27 14:42 232 查看
大致题意:

输入一个字典,字典格式为“英语à外语”的一一映射关系

然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh”

#include<iostream>
#include<cstdio>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main()
{
map<string,string> map1;
char a[50],b[20],c[20];
while(gets(a)&&a[0]!='\0')
{
sscanf(a,"%s %s",&b,&c);
map1[c]=b;
}
while(gets(a)&&a[0]!='\0')
{
if(map1.find(a)==map1.end())
cout<<"eh"<<endl;
else  cout<<map1[a]<<endl;
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: