ZOJ1109_Language of FatMouse(STL/map)
解题报告
题意:
略。
思路:
map应用。
#include <algorithm> #include <iostream> #include <cstring> #include <cmath> #include <queue> #include <vector> #include <cstdio> #include <map> using namespace std; map<string,string>Map; int main() { string str1,str2,str; int i,j; while(getline(cin,str)) { str1.clear(); str2.clear(); if(str[0]=='\0')break; for(i=0;i<str.length();i++) { if(str[i]==' ') break; str1+=str[i]; } str1[i]='\0'; for(j=i+1;j<str.length();j++) str2+=str[j]; Map[str2]=str1; } while(cin>>str1) { if(!Map[str1].empty()) cout<<Map[str1]<<endl; else cout<<"eh"<<endl; } return 0; }
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 ogday cat atcay pig igpay froot ootfray loops oopslay atcay ittenkay oopslay
Output for Sample Input
cat eh loops
相关文章
- golang中的map并发读写问题: Golang 协程并发使用 Map 的正确姿势
- Map集合总结
- java map 转string_java-将Map <String,Object>转换为Map <String,String>
- java map转json字符_Map转JSON字符串
- java工具类-Java对象转换成Map
- Map集合转换成实体类对象,实体类对象转换为map集合,互转工具类「建议收藏」
- Java9-day04【Map】课后习题
- es6 set和map_数据结构什么叫度
- 一文了解source-map
- 遍历map的几种方法?_hashmap如何遍历
- strm().filter().collect()和stream().map().collect()的作用
- go中的fatal error:concurrent map read and map write
- Go错误集锦 | map中因mutex使用不当导致的数据竞争
- list与Set、Map区别及适用场景详解编程语言
- 深入浅出Redis查看Map(redis查看map)
- Redis快速遍历Map的技巧(redis 遍历map)
- Oracle应用Map参数的优势初探(map参数 oracle)
- 基于Redis集群的Map数据结构的删除(redis集群map删除)
- 在Redis中使用Map存储数据(redis里面加入map)
- 使用Oracle Map方法开启新视野(oracle map方法)
- Redis解锁Map中蕴藏的绝技(redis获取map的值)