题目大意:
给你一本字典。字典上每一行为一个英语单词和一个其他国家单词。这样我们就可以通过字典把英语单词
翻译成其他国家单词,也可以将其他国家单词翻译为英语单词了。现在再给你几个外国单词,问:字典中
是否有这个单词的翻译。如果有,就输出翻译,否则,输出"eh"。
思路:
这道题其实可以用STL中的map或是字典树来做。map的做法是,建立两个map,一个对应存放翻译,一
个用来判断翻译是否存在。注意输入可以先将一行输入进来,判断是否为"\n"。再用sscanf将英语单词和
其他国家单词拆分为两个字符串s,...
分类:
其他好文 时间:
2015-04-26 16:44:25
阅读次数:
130
题目链接
题意:给定字符串以及对应的字符串,再给字符串找到对应的字符串,不存在输出"eh"。
思路:造模板。
/*********************************************************
file name: poj2503.cpp
author : kereo
create time: 2015年04月12日 星期日 17时13分1...
分类:
其他好文 时间:
2015-04-13 09:40:36
阅读次数:
114
BabelfishDescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunat...
分类:
其他好文 时间:
2014-10-29 23:47:14
阅读次数:
350
输入一个字典,字典格式为“英语à外语”的一一映射关系然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh”poj2503题目意思很简单:就像查找一本字典,根据输入的条目和要查询的单词,给出查询结果(每个单词长度不超过10)。这题有很多实现方式,最容易想到的就是ma...
分类:
其他好文 时间:
2014-10-09 01:54:37
阅读次数:
197
Babelfish
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 32988
Accepted: 14189
Description
You have just moved from Waterloo to a big city. The people here ...
分类:
其他好文 时间:
2014-09-18 20:47:04
阅读次数:
232
#include #include #include using namespace std;char s[100],s1[100],s2[100];map my;map ::iterator it;int main(int argc, char *argv[]){int i;while (ge.....
分类:
其他好文 时间:
2014-08-10 12:44:00
阅读次数:
203
Description
You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand...
分类:
其他好文 时间:
2014-08-08 12:47:45
阅读次数:
296
字典树的应用题目,虽然照模板就能打出来,但是看着学长的代码,学会了sscanf的用法,sscanf(str,"%s%s",a,b)把str分成a和b两个字符串,分隔符为空格#include#include#include#include#includeusing namespace std;int ...
分类:
其他好文 时间:
2014-08-04 17:07:47
阅读次数:
173
Description
You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them....
分类:
其他好文 时间:
2014-07-31 00:07:15
阅读次数:
222
题目地址:Babelfish题目大意: 你将要迁徙一个大城市里,但是你们的语言不一样。但是幸运的是你有一本字典,通过你的字典可以翻译外国的语言。每一行先是字典的单词接着是外国语言。 字典输完,给你几个外国语言,输出字典的单词否则输出“eh”。解题思路: map将每一行的单词mp一个整数,这整数可.....
分类:
其他好文 时间:
2014-07-25 14:07:01
阅读次数:
263