poj 2503 Babelfish (查找 map)

时间:2023-03-08 23:39:35
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 ;
}