POJ 2503 Babelfish
来源:互联网 发布:gis空间分析实例数据 编辑:程序博客网 时间:2024/06/05 15:23
Babelfish
Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 40265 Accepted: 17159
Description
You have just moved from Waterloo to a big city. The people here speak an incomprehensible(费解的) dialect(方言) of a foreign language. Fortunately, you have a dictionary to help you understand them.
Input
Input(投入) consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message of up to 100,000 words. Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word appears more than once in the dictionary. The message is a sequence(序列) of words in the foreign language, one word on each line. Each word in the input is a sequence of at most 10 lowercase(小写字母) letters.
Output
Output(输出) is the message translated to English, one word per line. Foreign words not in the dictionary should be translated as "eh".
Sample Input
dog ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslay
Sample Output
catehloops
Hint
Huge input(投入) and output,scanf and printf(打印函数) are recommended.
这题的做法有很多,排序加二分,字典树,哈希都可以,最简单粗暴的就是直接用map水。
这题的做法有很多,排序加二分,字典树,哈希都可以,最简单粗暴的就是直接用map水。
#include<iostream>#include<cstdio>#include<cstring>#include<map>#include<string>using namespace std;int main(){ map<string,string>A; char a[110],b[110],c[110]; while(gets(a)&&a[0]!='\0') { sscanf(a,"%s%s",&b,&c); A[c]=b; } while(~scanf("%s",&a)) { if(A.find(a)==A.end()) cout<<"eh"<<endl; else cout<<A[a]<<endl; } return 0;}
0 0
- poj 2503 Babelfish
- POJ 2503 Babelfish(HASH)
- poj 2503 Babelfish
- POJ 2503 Babelfish
- POJ 2503 Babelfish
- poj 2503 Babelfish
- POJ 2503 Babelfish
- poj 2503 Babelfish 【hash】
- poj 2503 Babelfish【trie】
- POJ 2503 Babelfish
- poj-2503 Babelfish
- poj-2503 Babelfish
- poj 2503 Babelfish
- poj 2503 Babelfish
- POJ 2503 Babelfish
- POJ 2503 Babelfish (Hash)
- POJ 2503 Babelfish
- poj 2503 Babelfish(二分)
- Linux驱动静态加载和动态加载详解
- 【牛客网】最简真分数
- 多核
- HDU 5029 树链剖分
- Excel文件的导入导出实战(2)--完成学生信息导出为Excel文件模块
- POJ 2503 Babelfish
- 下拉刷新必备技能
- 使用Scroller实现View的弹性滑动
- Linux中在防火墙中开启80端口的例子
- TCP/IP、Http、Soap三个基本的通讯协议有什么区别?
- eclipse中引入tomcat源码
- Java Web - Jsp内置对象
- java项目之——坦克大战03
- 动静态广播的区别