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

就是一个哈夫曼树,题目下边有提示,所以题意还是好理解的

#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 ;
}

POJ3253Babelfish的更多相关文章

随机推荐

  1. windows通过thrift访问hdfs

    thirift是一个支持跨种语言的远程调用框架,通过thrift远程调用框架,结合hadoop1.x中的thriftfs,编写了一个针对hadoop2.x的thriftfs,供外部程序调用. 1.准备 ...

  2. centos6.5 安装mono

    mono是一个在linux下兼容.net的软件.安装之前要把开发包装好 源码安装mono wget http://download.mono-project.com/sources/mono/mono ...

  3. UINavigationController 与 UITabBarController

    http://www.cnblogs.com/YouXianMing/p/3756904.html // index start from 1. UITabBarItem *newsItem = [[ ...

  4. 【面试虐菜】—— JAVA面试题(3)

    1 throws与throw的区别 解析:throws和throw是异常处理时两个常见的关键字,初级程序员常常容易正确理解throw和throws的作用和区别,说明已经能比较深入理解异常处理.Thro ...

  5. PAT IO-02 整数四则运算

    /* *PAT IO-02 整数四则运算 *2015-07-30 *作者:flx413 */ #include<stdio.h> int main() { int a, b; scanf( ...

  6. SSH时不需输入密码

      我这里有2台机器,一台装了Teradata数据库,ip是192.168.184.128,称它为teradata-pc:另一台装了Oracle数据库,ip地址是192.168.184.129,称它为 ...

  7. ORA-15221: ASM operation requires compatible.asm of 11.2.0.0.0 or higher

    昨天在做存储迁移的时候,对ASM磁盘组的东西进行操作时,出现了如标题的错误.经查资料,发现原因如下:     如磁盘组是使用asmca图形化工具创建,则compatible.asm默认设置就已经为11 ...

  8. 使用ab测试工具 进行并发测试

    ab.exe -n1000 -c100 http://localhost:8067/api/todo/555e95feb301baa678141148 http://www.cnblogs.com/y ...

  9. JPages分页插件的使用

    废话不多说,直接上代码. 首先下载JPages的js和css包,附上下载地址:http://dl.oschina.net/softfile/jpages/jpages-latest-138554713 ...

  10. 注册微信小程序

    注册微信小程序 小程序是一种新的开放能力,可以在微信内被便捷地获取和传播,同时具有出色的使用体验.开发者可以根据平台提供的能力,快速地开发一个小程序. 开放内容包括: 开放注册范围:企业.政府.媒体. ...