poj 2503 Babelfish (查找 map)
题目:http://poj.org/problem?id=2503
不知道为什么 poj 的 数据好像不是100000,跟周赛的不一样
2000MS的代码:
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<stack>
#include<queue>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std; char str[][];
int main()
{
int i,j;
char s1[];
map<string,int>mp;
i=;
while()
{
char t; j=;
if((t=getchar())=='\n')
break;
str[i][j++]=t;
while()
{
t=getchar();
if(t==' ')
{
str[i][j]='\0';
break;
}
else
str[i][j++]=t;
}
scanf("%s",s1);
mp[s1]=i;
i++;
getchar();
}
while(gets(s1)!=NULL)
{
if(mp[s1]>=)
printf("%s\n",str[mp[s1]]);
else
printf("eh\n");
}
return ;
}
poj 2503 Babelfish (查找 map)的更多相关文章
- POJ 2503 Babelfish(map,字典树,快排+二分,hash)
题意:先构造一个词典,然后输入外文单词,输出相应的英语单词. 这道题有4种方法可以做: 1.map 2.字典树 3.快排+二分 4.hash表 参考博客:[解题报告]POJ_2503 字典树,MAP ...
- 题解报告:poj 2503 Babelfish(map)
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...
- poj 2503 Babelfish(Map、Hash、字典树)
题目链接:http://poj.org/bbs?problem_id=2503 思路分析: 题目数据数据量为10^5, 为查找问题,使用Hash或Map等查找树可以解决,也可以使用字典树查找. 代码( ...
- Poj 2503 Babelfish(Map操作)
一.Description You have just moved from Waterloo to a big city. The people here speak an incomprehens ...
- poj 2503 Babelfish(字典树或map或哈希或排序二分)
输入若干组对应关系,然后输入应该单词,输出对应的单词,如果没有对应的输出eh 此题的做法非常多,很多人用了字典树,还有有用hash的,也有用了排序加二分的(感觉这种方法时间效率最差了),这里我参考了M ...
- poj 2503:Babelfish(字典树,经典题,字典翻译)
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 30816 Accepted: 13283 Descr ...
- poj 2503 Babelfish(字典树或着STL)
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 35828 Accepted: 15320 Descr ...
- poj 2503 哈希 Map 字典树
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 36967 Accepted: 15749 Descr ...
- POJ 2503 Babelfish
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 28766 Accepted: 12407 Descripti ...
随机推荐
- css3中的动画处理
动画--过渡属性 div { width: 200px; height: 200px; background: red; margin: 20px auto; /* -webkit-transitio ...
- Sublime Text 3 使用备注
去年开始为了正规化自己的日常编辑工作,在dw,editplus,notap++,st里做了个选择,最终决定改曾经的dw为st. 毕竟dw是上个世纪的东西了,体积比较臃肿了.所以,在这里记录关于st的使 ...
- 开源 侧滑 和 Tab滑动翻页 控件
侧滑 https://github.com/jfeinstein10/SlidingMenu Tab滑动翻页 https://github.com/astuetz/PagerSlidingTabStr ...
- Angular之【form提交问题】
前端页面是这样: <form class="form-horizontal" role="form" name="LoginForm" ...
- 一个汉字的ASCII编码 
一个汉字的ASCII编码:
- ComboBox Control Messages 消息
连接到MSDN,有时间完善这个.具体说明可点击进入msdn CB_ADDSTRING 添加一个字符串组合框的列表框.如果组合框没有cbs_sort风格,字符串添加到列表的结尾.否则,该字符串插入列表, ...
- 扩展ServiceHost<T>类
public class ServiceHost<T> : ServiceHost { public void EnableMetadataExchange(bool enableHttp ...
- linux 加载驱动后有permanent的解决办法
参考http://blog.csdn.net/zmnqazqaz/article/details/38058713解决 原因是系统默认内核使用gcc与当前编译模块gcc版本不同导致的. 查看内核默认使 ...
- AJAX 基础知识
1.AJAX 是一种用于创建快速动态网页的技术.而是一种用于创建更好更快以及交互性更强的 Web 应用程序的技术.通过在后台与服务器进行少量数据交换,AJAX 可以使网页实现异步更新.这意味着可以在不 ...
- MQ 2035(MQRC_NOT_AUTHORIZED)
当使用MQ7.1或7.5时,如果使用MQ管理员账号去连接MQ服务器,可能会报以下的错误,提示你权限不足. 2035 MQRC_NOT_AUTHORIZED 在之前的版本中是没有这个问题的. 原因是在7 ...