Language of FatMouse(map,空行处理)
来源:互联网 发布:mac音量键被禁用 编辑:程序博客网 时间:2024/04/30 12:09
C - Language of FatMouseTime Limit:10000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Description
We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him.
Input Specification
Input consists of up to 100,005 dictionary entries, followed by a blank line, followed by a message of up to 100,005 words. Each dictionary entry is a line containing an English word, followed by a space and a FatMouse word. No FatMouse word appears more than once in the dictionary. The message is a sequence of words in the language of FatMouse, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters.
Output Specification
Output is the message translated to English, one word per line. FatMouse words not in the dictionary should be translated as "eh".
Sample Input
dog ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslay
Output for Sample Input
catehloops
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <map>#include <string>#include <algorithm>#include <queue>using namespace std;struct node{ char a[15]; int s;};int main(){ char c[15],d[15]; char r[15]; map<string,node >q; while(1) { gets(r); if(strlen(r) == 0) break; sscanf(r,"%s %s",c,d); q[d].s++; strcpy(q[d].a,c); } char e[15]; while(~scanf("%s",e)) { if(q[e].s!=0) { printf("%s\n",q[e].a); } else printf("eh\n"); } return 0;}
Description
We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him.
Input Specification
Input consists of up to 100,005 dictionary entries, followed by a blank line, followed by a message of up to 100,005 words. Each dictionary entry is a line containing an English word, followed by a space and a FatMouse word. No FatMouse word appears more than once in the dictionary. The message is a sequence of words in the language of FatMouse, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters.
Output Specification
Output is the message translated to English, one word per line. FatMouse words not in the dictionary should be translated as "eh".
Sample Input
dog ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslay
Output for Sample Input
catehloops
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <map>#include <string>#include <algorithm>#include <queue>using namespace std;struct node{ char a[15]; int s;};int main(){ char c[15],d[15]; char r[15]; map<string,node >q; while(1) { gets(r); if(strlen(r) == 0) break; sscanf(r,"%s %s",c,d); q[d].s++; strcpy(q[d].a,c); } char e[15]; while(~scanf("%s",e)) { if(q[e].s!=0) { printf("%s\n",q[e].a); } else printf("eh\n"); } return 0;}
- Language of FatMouse(map,空行处理)
- Language of FatMouse(输入输出格式+STL的map)
- Language of FatMouse(trie树)
- ZOJ1109 Language of FatMouse
- Language of FatMouse
- C - Language of FatMouse
- zoj_1109 Language of FatMouse
- ZOJ1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- ZOJ1109 Language of FatMouse,BST
- zoj 1109 Language of FatMouse
- ZOJ 1109Language of FatMouse
- zoj 1109.Language of FatMouse
- ZOJ 1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- zoj 1109 Language of FatMouse
- ZOJ-1109 -Language of FatMouse
- 3.Python调用C语言之使用指针
- Android之对话框Dialog(二)
- Linux命令:touch
- Eclipse中插入颜色的十六进制值
- PCL KinFusion配置 三维重建
- Language of FatMouse(map,空行处理)
- C语言中的二维数组
- winpcap使用注意事项及常见问题
- 【8.9】重拾编程之心 & Java基础
- HDU--1429 胜利大逃亡(续)
- tip11:在operator=中处理自我赋值
- 动态规划之钢条切割问题
- 输入一个字符串只包含“0~10”和”,“找出最小的数字和最大的数字(可能不止一个),输出最后剩余数字的个数,如输入”3,3,4,5,6,7,7“
- Linux命令:cat