Poj 2503 Babelfish
来源:互联网 发布:老司机 知乎 收藏夹 编辑:程序博客网 时间:2024/06/10 13:25
Babelfish
Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 34221 Accepted: 14678
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.
题意:
输入一个字典,字典格式为“英语à外语”的一一映射关系
然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh”
偷个懒,直接用map水了;
#include <iostream>#include <string>#include <map>#include <set>using namespace std;int main(){ string s, a, b; map<string, bool> apperance; map<string, string>dic; while (getline(cin, s) && s != ""){ int pos = s.find(' '); a.assign(s, 0, pos); b.assign(s, pos+1, s.size()-1); apperance.insert(make_pair(b, true)); dic.insert(make_pair(b, a)); } while (cin >> s){ if (apperance[s]){ cout << dic[s] << endl; } else{ cout << "eh" << endl; } }}
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(二分)
- 管理学的二十大定律
- XIB、Storyboard操作小技巧
- Eclipse设置类似Sublime Text 编辑区皮肤,风格,颜色
- Android开发铃声的设置与播放
- Frame,Bounds和Center的区别,联系
- Poj 2503 Babelfish
- 从不同步的代码块中调用了对象同步方法 C#
- opencv实现车牌识别之字符识别
- 《网络流学习笔记05--最小割最大流问题》
- 一、STM32L0538DISCOVERY 开发板到手
- hdu 4438
- uvalive4794(集合+状态压缩)
- NFS性能优化手册
- linux的secureCRT的连接