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. 【iOS】iOS之Button segue弹出popOver消除(dismiss)问题

    如图.由于程序须要,点击Button Ctrl+Dragging加入了一个UITableViewController,当然其余的Controller也能够,这样我们在方法 -(void)prepare ...

  2. char* 和char[]的差别

    下面内容均来自互联网,系笔者汇总并总结. 1. 问题介绍 问题引入: 在实习过程中发现了一个曾经一直默认的错误,相同char *c = "abc"和char c[]="a ...

  3. Android群英传》读书笔记 (3) 第六章 Android绘图机制与处理技巧 + 第七章 Android动画机制与使用技巧

    第六章 Android绘图机制与处理技巧 1.屏幕尺寸信息屏幕大小:屏幕对角线长度,单位“寸”:分辨率:手机屏幕像素点个数,例如720x1280分辨率:PPI(Pixels Per Inch):即DP ...

  4. RHEL7重置root密码

    一.rd.break方法 在linux16那一段的最后,空一格输入rd.break 按Ctrl+启动到单用户模式,如下: 进去后输入命令mount,发现根为/sysroot/,并且不能写,只有ro=r ...

  5. Nodejs服务器端脚本

    首先是安装,安装很简单,下载一个msi文件后一路下一步,没有难度, 测试的时候,如果你发现你的环境变量里面没有自动添加进去,也可以进行手动添加环境变量 之后在命令窗口输入: 得到nodejs的版本就说 ...

  6. CSS的clip-path(转)

    基本概念 clip-path从单词"clip path"的直译上来说,表示的就是裁剪路径.既然有裁剪,咱们就来了解这里面的几个简单的概念. 裁剪就是从某样东西剪切一块.比如说,我们 ...

  7. Registry 类

    提供表示 Windows 注册表中的根项的 RegistryKey 对象,并提供访问项/值对的 static 方法. 继承层次结构 System.Object   Microsoft.Win32.Re ...

  8. 数据库连接报错之IO异常(The Network Adapter could not establish the connection)

    Io 异常: The Network Adapter could not establish the connection 有以下四个原因: 1.oracle配置 listener.ora 和tnsn ...

  9. SDWebImage 在多线程下载图片时防止错乱的策略

    在我们使用sd的时候,对tableView  上cell得图片进行异步下载的时候会遇到这样一个问题: 由于cell的重用机制,在我们加载出一个cell的时候imageView数据源开启一个下载任务并返 ...

  10. npm的镜像替换成淘宝

    1.得到原本的镜像地址 npm get registry > https://registry.npmjs.org/ 设成淘宝的 npm config set registry http://r ...