ZOJ1109_Language of FatMouse(STL/map)
解题报告
题意:
略。
思路:
map应用。
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <map> using namespace std;
map<string,string>Map;
int main()
{ string str1,str2,str;
int i,j;
while(getline(cin,str))
{
str1.clear();
str2.clear();
if(str[0]=='\0')break;
for(i=0;i<str.length();i++)
{
if(str[i]==' ')
break;
str1+=str[i];
}
str1[i]='\0';
for(j=i+1;j<str.length();j++)
str2+=str[j];
Map[str2]=str1;
}
while(cin>>str1)
{
if(!Map[str1].empty())
cout<<Map[str1]<<endl;
else cout<<"eh"<<endl;
}
return 0;
}
Language of FatMouse
Time Limit: 10 Seconds Memory Limit: 32768 KB
We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him.
Input Specification
Input consists of up to 100,005 dictionary entries, followed by a blank line, followed by a message of up to 100,005 words. Each dictionary entry is a line containing an English word,
followed by a space and a FatMouse word. No FatMouse word appears more than once in the dictionary. The message is a sequence of words in the language of FatMouse, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters.
Output Specification
Output is the message translated to English, one word per line. FatMouse words not in the dictionary should be translated as "eh".
Sample Input
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay atcay
ittenkay
oopslay
Output for Sample Input
cat
eh
loops
ZOJ1109_Language of FatMouse(STL/map)的更多相关文章
- stl::map之const函数访问
如何在const成员数中访问stl::map呢?例如如下代码: string ConfigFileManager::MapQueryItem(const string& name) const ...
- hdu4941 Magical Forest (stl map)
2014多校7最水的题 Magical Forest Magical Forest Time Limit: 24000/12000 MS (Java/Others) Memory Limit ...
- [CareerCup] 13.2 Compare Hash Table and STL Map 比较哈希表和Map
13.2 Compare and contrast a hash table and an STL map. How is a hash table implemented? If the numbe ...
- STL MAP及字典树在关键字统计中的性能分析
转载请注明出处:http://blog.csdn.net/mxway/article/details/21321541 在搜索引擎在通常会对关键字出现的次数进行统计,这篇文章分析下使用C++ STL中 ...
- POJ 3096 Surprising Strings(STL map string set vector)
题目:http://poj.org/problem?id=3096 题意:给定一个字符串S,从中找出所有有两个字符组成的子串,每当组成子串的字符之间隔着n字符时,如果没有相同的子串出现,则输出 &qu ...
- STL MAP 反序迭代
ITS_NOTICE_MAP::reverse_iterator it = noticeMap.rbegin(); for ( ; it != noticeMap.rend(); ++it ) { I ...
- 泛型Binary Search Tree实现,And和STL map比较的经营业绩
问题叙述性说明: 1.binary search tree它是一种二进制树的.对于key值.比当前节点左孩子少大于右子. 2.binary search tree不是自平衡树.所以,当插入数据不是非常 ...
- Dictionary,hashtable, stl:map有什么异同?
相同点:字典和map都是泛型,而hashtable不是泛型. 不同点:三者算法都不相同 Hashtable,看名字能想到,它是采用传统的哈希算法:探测散列算法,而字典则采用的是散列拉链算法,效率较高, ...
- STL Map和multimap 容器
STL Map和multimap 容器 map/multimap的简介 map是标准的关联式容器,一个map是一个键值对序列,即(key,value)对.它提供 基于key的快速检索能力. ...
随机推荐
- 使ViewFlipper中的WebView实现手势效果
使ViewFlipper中的WebView实现手势效果 今天写Blog阅读器的时候遇到了这个问题,把它分享给大家,让同样是新手们少走冤枉路始初写这个功能的时候,用过了好多方法,也耗了不少时间去研究 ...
- Xamarin Mono Android Ios 安装、破解(4.12)
一.Windows下面的安装 1. 安装环境介绍: Win8.1 企业版64位.VS2013,mono-android-4.12.02001,下面的安装过程都是在VS2013已经安装成功之后的操作,本 ...
- linux的文件属性介绍、目录及路径表示方法
一.认识linux文件 认识linux下的文件需要先学习命令:ls. 该命令用于显示指定目录下的内容,其中最常用的参数有: -l显示目录和文件的完整属性信息 -a显示所有文件和目录,包含隐藏文件和目录 ...
- 利用ASP.NET MVC源代码调试你的应用程序[转]
由于项目需要,最近学起asp.net mvc.昨天遇到ViewData和TempData他们之间的分别这样让我纠结的问题.有园友强烈建议我去看ASP.NET MVC的源代码.所以,我想到如何在调试AS ...
- kendoui-grid篇
kendo确实是个好东西,能够让我们专注于后端开发,无需在效果呈现上花大力气,唯一的缺点,它是收费的,但是我目前还没发现为嘛要掏钱,因为free的也满足了我的需求. kendoUI For asp.m ...
- CSS Sprite的优缺点分析
目前大多数的开发人员对这个技术都有相当地掌握,也有很多关于它的教程和文章.几乎所有的文章中都宣称设计师和开发人员都应该使用 CSS sprite 来减少 HTTP 请求数,并且节省一些流量.这个技术被 ...
- Tkinter教程之Grid篇
本文转载自:http://blog.csdn.net/jcodeer/article/details/1813196 '''Tkinter教程之Grid篇'''# Tkinter参考中最推荐使用的一个 ...
- 办公室网络二三事 - chunyu
开始的时候,我们办公室拉了两条家庭百兆宽带,两条宽带分别接到路由器的wan1/wan2口上,我们愉快的工作愉快的上网. 后来,再拉了一条十兆企业专线,接到了路由器的wan3口上面,配了一些静态路由,希 ...
- 最近的bug列表总结(C++)
最近写了一大段代码,抽象得厉害,容易绕进去,因为写单测的代价很大(借口),所以很多问题到联调的是否才发现. 而且花费了很大的经历才查出来,主要问题有如下几个问题 1. 变量未初始化 具体来说,就是指针 ...
- MongoDB的备份与恢复
0. 目录 整库备份 整库恢复 单collection备份 单collection恢复 1. 备份 MongoDB提供了备份工具,mongodump.exe,在bin目录下,其用法如下: mongod ...