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 ...
随机推荐
- 判断IE版本的语句 [if lte IE 6]...[endif]
<!–[if lte IE 6]>……<![endif]–>Ite:less than or equal to意思是小于或等于IE6浏览器,用于IE浏览器的条件注释,常用于CS ...
- 定时备份服务器数据库(借助windows任务计划以及mysqldump)
最近社区多了,考虑到数据的安全性,要每天备份一次数据库,以防万一: linux目前还不是很了解,先用windows的计划任务吧: 大体思路就是 借用windows的计划任务来执行备份远程数据库到本地: ...
- zencart后台增加菜单选项
如果要在程序中使用额外的参数,在后台控制,添加到菜单属性 在后台 SQL脚本 运行如下 SQL语句 INSERT INTO configuration (configuration_title, co ...
- xaml中绑定单例属性
在项目中经常会遇到,同一个字典表绑定到多个ItemsControl上的情况,可以在单例中创建一个List,xaml上绑定即可.看代码: 1,XAML <Grid> <StackPan ...
- C# asp Aspose.Cells 教程,包含增加勾选框,单元格,字体设置
1,引用Aspose.Cells dll 2,using Aspose.Cells; 3, Workbook excel = new Workbook(); string strFilePath = ...
- Group 原则
select 后面的所有劣种,没有使用聚合函数的列,必须出现在 group by 后面,比如下面的例子 insert into #temp_move2 ) from #temp_move group ...
- NSInvocation的使用(转)
转载自:http://www.cnblogs.com/pengyingh/articles/2359199.html http://blog.iosxcode4.com/?p=125 在 iOS中可以 ...
- Jquery实现自动提示下拉框
1.引入脚本库: <script type="text/javascript" src="/Jscripts/jquery-1.3.2.js"&g ...
- HTML网页中添加音频视频动画...(转)
在网页中适当嵌入音频和视频能够充分显示网页的多媒体特性,特别是随着宽带网的普及,使得网络广播和网络视频成为现实,网页音频和视频的重要性也日益突显.具体来说,网页音频和视频的嵌入方法主要有三种: 一.b ...
- SSH开发框架搭建参考
一, 参考文章: 1, http://blog.csdn.net/communicate_/article/details/8644040 这篇文章讲的还算详尽,但是貌似有一些多余的代码: 2,