http://poj.org/problem?id=2503

这个题一开始是想用字典树,发现太麻烦。。。。。

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
using namespace std;
int main ()
{
map<string, string> tra;
char s[], str[], s1[];
while (gets(s)&&s[])
{
sscanf(s,"%s %s",str,s1);//输入一个字符串,空格前的存到str里边,后边的存到s1里边
tra.insert(pair<string,string>(s1,str));
}
while(cin>>str)
{
if (tra.find(str) != tra.end())
cout<<tra[str]<<endl;
else
cout<<"eh"<<endl;
}
return ;
}

POJ2503Babelfish的更多相关文章

  1. poj2503--Babelfish(特里一水)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 32988   Accepted: 14189 Descr ...

  2. C++-POJ2503-Babelfish[hash]

    哈个希加挂个链表 一个要背的字符串hash函数ELFhash() mod数取数据最大容量的1.5倍最佳?! #include <set> #include <map> #inc ...

随机推荐

  1. (转)HTML5游戏如何挣钱?2条经验让你每款赚3万刀

    原文作者:Alexander Krug,是世界上最大的HTML5游戏平台的运营商SOFTGAMES的CEO. 现今苹果App Store当中的应用数量可以以海量来形容,最新发布的应用对排行榜的冲击力也 ...

  2. 转:Java HashMap实现详解

    Java HashMap实现详解 转:http://beyond99.blog.51cto.com/1469451/429789 1.    HashMap概述:    HashMap是基于哈希表的M ...

  3. js 函数闭包内部返回函数体调用方法难点解答

    今天在网上,看到一篇关于js函数难点的文章,js函数的一些难点.在那上面提了一下,关于js函数返回另一个函数的问题,并附上了一道面试题: var add = function(x){ var sum ...

  4. Linux下iptables拦截Nginx的问题

    环境:CentOS 6.4 X64,Nginx 1.5.3 问题:配置好Nginx后,加入了“iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT” ...

  5. html设置360兼容/极速模式

    由于众所周知的情况,国内的主流浏览器都是双核浏览器:基于Webkit内核用于常用网站的高速浏览.基于IE的内核用于兼容网银.旧版网站.以360的几款浏览器为例,我们优先通过Webkit内核渲染主流的网 ...

  6. 2.opencv图像处理常用操作

    图像的平滑处理 平滑,也称 模糊, 平滑处理时需要用到一个滤波器 .滤波器想象成一个包含加权系数的窗口,这个加权系数也叫做核或者模版. // 图像平滑处理分而学之.cpp : 定义控制台应用程序的入口 ...

  7. 1066. Root of AVL Tree (25)

    An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child sub ...

  8. 1097. Deduplication on a Linked List (25)

    Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated ...

  9. 多实例MySQL批量添加用户和密码并授权

    OS:Cent OS 6.3 DB:5.5.14 如果一台服务器上有100个MySQL数据库实例,此时需要给不同端口的几个数据库添加用户名.密码并授权应用IP,一个个授权没问题,反正累的不是我,哇咔咔 ...

  10. EditorWindow 和MenuItem

    using UnityEngine; using System.Collections; using UnityEditor; public class ClipEventEditor : Edito ...