题目: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)的更多相关文章

  1. POJ 2503 Babelfish(map,字典树,快排+二分,hash)

    题意:先构造一个词典,然后输入外文单词,输出相应的英语单词. 这道题有4种方法可以做: 1.map 2.字典树 3.快排+二分 4.hash表 参考博客:[解题报告]POJ_2503 字典树,MAP ...

  2. 题解报告:poj 2503 Babelfish(map)

    Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...

  3. poj 2503 Babelfish(Map、Hash、字典树)

    题目链接:http://poj.org/bbs?problem_id=2503 思路分析: 题目数据数据量为10^5, 为查找问题,使用Hash或Map等查找树可以解决,也可以使用字典树查找. 代码( ...

  4. Poj 2503 Babelfish(Map操作)

    一.Description You have just moved from Waterloo to a big city. The people here speak an incomprehens ...

  5. poj 2503 Babelfish(字典树或map或哈希或排序二分)

    输入若干组对应关系,然后输入应该单词,输出对应的单词,如果没有对应的输出eh 此题的做法非常多,很多人用了字典树,还有有用hash的,也有用了排序加二分的(感觉这种方法时间效率最差了),这里我参考了M ...

  6. poj 2503:Babelfish(字典树,经典题,字典翻译)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 30816   Accepted: 13283 Descr ...

  7. poj 2503 Babelfish(字典树或着STL)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 35828   Accepted: 15320 Descr ...

  8. poj 2503 哈希 Map 字典树

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 36967   Accepted: 15749 Descr ...

  9. POJ 2503 Babelfish

    Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 28766 Accepted: 12407 Descripti ...

随机推荐

  1. 解决mac下eclipse字体模糊

    在eclipse.app右键,单击“显示包内容”,如下图: 2.找到"info.plist"文件并打开,在文件最后插入配置“<key>NSHighResolutionC ...

  2. Linux编程学习笔记 -- Process

    进程是一个程序的运行.   在一个程序中执行另一个执程序的方法有两种: 1)system 在shell中执行程序 2)fork + exec 复制一个进程,在进程中用新的程序替换原有的程序   for ...

  3. Linux 查看某个用户的进程

    Linux 查看某个用户的进程 To view only the processes owned by a specific user, use the following command: top ...

  4. NYOJ 994 海盗分金 逆向递推

    链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=994 题意: 有n个海盗劫得了窖藏的m块金子,并准备瓜分这些战利品.按照古老流传下来的分金法则 ...

  5. android 注销

    1.在个人中心退出系统MainActivity 2.清空保存的登录数据 3.打开登录LoginActivity 方法: SharedPreferencesManager.getInstance(mCo ...

  6. HTML标签语义对照表

    标签名 英文全拼 中文翻译 div division 分隔 span span 范围 ol ordered list 排序列表 ul unordered list 不排序列表 li list item ...

  7. 深度:ARC会导致的内存泄露

    iOS提供了ARC功能,很大程度上简化了内存管理的代码. 但使用ARC并不代表了不会发生内存泄露,使用不当照样会发生内存泄露. 下面列举两种内存泄露的情况. 1,循环参照 A有个属性参照B,B有个属性 ...

  8. 有关hadoop分布式配置详解

    linux配置ssh无密码登录 配置ssh无密码登录,先要安装openssh,如下: yum install openssh-clients 准备两台linux服务器或虚拟机,设置两台linux的ho ...

  9. Mac - 更新 Ruby

    因为准备在项目中使用bootstrap,在安装bootstrap过程中提示需要Ruby的版本在1.9.2以上,而目前使用的Ruby版本是Mac系统自带的1.8.7.所以需要对Ruby进行升级.这里使用 ...

  10. shell复习笔记----用户管理

    $ who    可以知道系统上有多少登陆 $who |wc -l 计算用户个数 注意:|是管道符号,可以在两个程序之间建立管道(pipeline):who 的输出,成了 wc 的输入, wc 所列出 ...