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 ...
随机推荐
- ajax分页效果实现
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- html实现层叠加
<div id="canvasesdiv" style="position:relative; width:400px; height:300px"> ...
- php中类的声明与使用
<?php /**php语言是支持面向对象编程的,对于面向对象的编程,学过java和C++的人都知道啊! *如果不清楚的去baidu问一下就可以了. */ //我们来定义一个类,定义类的关键字是 ...
- Jqplot在joomla组件中的应用
(1)在com_collect组件中采用的是ajax获取json类型的值.[http://www.jqplot.com/tests/data-renderers.php]这上边有实例. (2)在jqp ...
- 使用rar打包多个文件为exe可执行文件
需求分析:有些机友在刷recovery的时候不知道如何刷入,于是产生写bat脚本和打包为exe可执行文件,只要机友正确安装好驱动后连接手机双击就可以刷入rec了 解决过程: 需要打包的文件 操作过程截 ...
- linux驱动系列之挂载(转)
转自网页:http://www.cnblogs.com/yeahgis/archive/2012/04/05/2432779.html http://www.linuxso.com/command/c ...
- java后台SSH框架之Hibernate心得一
双向关联和单向关联 双向关联:这两个表无论哪一个更新另外一个表都更新 单向关联:就是只有一个主表更新从表才更新 从表更新主表不管 双向关联配置 表1配置 <set name="对象名称 ...
- NSFileHandle 和 NSFileManager的一些用法
文件操作 NSFileManager 常见的NSFileManager文件的方法: -(BOOL)contentsAtPath:path 从文件中读取数据 -(BOOL)createFileAtPat ...
- C#中字符串驻留技术
转自:http://www.cnblogs.com/Charles2008/archive/2009/04/12/1434115.html MSDN概念:公共语言运行库通过维护一个表来存放字符串,该表 ...
- [转载]获取当前日期和农历的js代码
原文地址: http://www.cnblogs.com/Gnepner/archive/2011/09/07/2169822.html 获取当前日期时间: function GetCurrentDa ...