Time Limit: 1000MS Memory limit: 65536K
题目描述
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 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 is the message translated to English, one word per line. Foreign words not in the dictionary should be translated as "eh".
示例输入
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay

atcay
ittenkay
oopslay示例输出
cat
eh
loops

这个题觉得不难,本意是字典树,自己不会,各种水,用数组也可以做,但是一定会超时

用map水了一下,感觉空行结束太没有爱了害我纠结了半天

 #include<cstdio>
#include<iostream>
#include<map>
using namespace std;
int main()
{
map<string,string>mapp;//map,不解释
char ch,s[],p[];
while(scanf("%c",&ch))
{
if(ch=='\n')break;//解决那个烦人的空行结束
s[]=ch;
scanf("%s",s+);
scanf("%s",p);
getchar();
mapp.insert(pair<string,string>(p,s));//插入语句
}
map<string,string>::iterator iter;//声明迭代器,别问我什么用,我也不知道
while(~scanf("%s",s))
{
iter=mapp.find(s);//查找啊
if(iter!=mapp.end())//这个说明找到了
printf("%s\n",iter->second.c_str());//打印出来,别忘了后面的.c_str();
else
printf("eh\n");
}
return ;
}

Babelfish的更多相关文章

  1. Babelfish(二分查找,字符串的处理略有难度,用sscanf输入)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 28581   Accepted: 12326 题目链接: ...

  2. poj 2503:Babelfish(字典树,经典题,字典翻译)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 30816   Accepted: 13283 Descr ...

  3. POJ 2503 Babelfish

    Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 28766 Accepted: 12407 Descripti ...

  4. Babelfish 分类: 哈希 2015-08-04 09:25 2人阅读 评论(0) 收藏

    Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 36398 Accepted: 15554 Descripti ...

  5. Poj 2503 / OpenJudge 2503 Babelfish

    1.Link: http://poj.org/problem?id=2503 http://bailian.openjudge.cn/practice/2503/ 2.Content: Babelfi ...

  6. POJ2503——Babelfish(map映射+string字符串)

    Babelfish DescriptionYou have just moved from Waterloo to a big city. The people here speak an incom ...

  7. Babelfish(二分)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 37238   Accepted: 15879 Descr ...

  8. http://begin.lydsy.com/JudgeOnline/problem.php?id=2770(PKU2503 Babelfish)

    2770: PKU2503 Babelfish Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 2  Solved: 2[Submit][Status][ ...

  9. Babelfish 基本试用

    测试使用docker 部署 docker-compose文件 注意网络模型选择的host,同时配置了opentracing 服务 version: "3" services:  b ...

  10. Babelfish 开源通用代码解析服务

    Babelfish 是一个开源的代码解析服务 参考架构 支持的语言 bash go java javascript php ruby c++ typescript 功能 我们可以使用此工具,进行大规模 ...

随机推荐

  1. Light OJ 1114 Easily Readable 字典树

    题目来源:Light OJ 1114 Easily Readable 题意:求一个句子有多少种组成方案 仅仅要满足每一个单词的首尾字符一样 中间顺序能够变化 思路:每一个单词除了首尾 中间的字符排序 ...

  2. Linux Resin 安装

    1 Resin 下载 Resin 官方下载网址. 最新版下载 resin-4.0.36.tar.gz(免费版) resin 安装须要提前配置好jdk.配置jdk请看上面文章 2 Resin 安装 (1 ...

  3. [RxJS] Stream Processing With RxJS vs Array Higher-Order Functions

    Higher order Array functions such as filter, map and reduce are great for functional programming, bu ...

  4. kswapd0、kjournald、pdflush、kblocked、migration进程含义 转

    kswapd0.kjournald.pdflush.kblocked.migration进程含义 1.kswapd0 Linux uses kswapd for virtual memory mana ...

  5. 基于HTML5的SLG游戏开发(一):搭建开发环境(1)

    开发环境: 1.操作系统:MacOS 10.8.5 2.本地web服务器:Apache 2.2.24 (Window环境推荐使用WampServer) 3.编码工具:WebStrom 7.0 4.调试 ...

  6. angular应用前景

    完成了angularJs的学习,突然想到,angularJS是否会影响到seo.于是查阅了很多资料,技术博客,这种想法得到了证实. 爬虫不能识别js渲染的内容.所以引起了我对angular应用前景的思 ...

  7. ArcMap - 分割.

    一,分割面: 1,在屏幕上新增线分割面: 使待编辑的面处于编辑状态 -> 选择待分割的面(使其处于选中状态) -> 选择编辑工具的 (Cut Polygons Tools) ->画线 ...

  8. 关于mssql数据库锁和事务隔离级别

    事务隔离级别有4种,这4种级别只是对于读操作,也就是select有不同程度的支持, 读未提交:不会对事务里读出来的数据附加任何锁 读已提交:会对事务里读出来的数据附加共享锁,读完就释放共享锁,其他事务 ...

  9. Core Animation之CAKeyframeAnimation

    在上一篇专题文章中我们学习了iOS核心动画CoreAnimation中CABasicAnimation动画的使用方法.CABasicAnimation已经可以应付一些比较简单的应用场景了,比如view ...

  10. Problem 1183 - 排列

    #include<iostream> #include<vector> #include<algorithm> using namespace std; int c ...