ZOJ 1109 Language of FatMouse
2013-04-04 23:16
381 查看
开始学习stl,准备记录下自己每天做的zoj题目。
这题用map类解起来并不困难,对字符串处理时用了substr。
题目连接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=109
这题用map类解起来并不困难,对字符串处理时用了substr。
题目连接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=109
#include<iostream> #include<map> #include<vector> #include<string> #include<stdio.h> using namespace std; int main() { string s; string s1,s2; char c[100]; int npos; map<string,string> fat; map<string,string>::iterator iter; while(gets(c)){ s.assign(c); if(s.size()==0) break; npos=s.find(' '); s1=s.substr(0,npos); s2=s.substr(npos+1); fat[s2]=s1; } while(gets(c)){ s.assign(c); iter=fat.find(s); if(iter!=fat.end()) cout<<fat[s]<<endl; else cout<<"eh"<<endl; } return 0; }
相关文章推荐
- ZOJ1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- zoj 1109 Language of FatMouse 【字典树】
- zoj 1109 Language of FatMouse(map映照容器的典型应用)
- zoj 1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse
- ZOJ Problem Set–1109 Language of FatMouse
- ZOJ 1109 Language of FatMouse (字典树)
- zoj 1109 Language of FatMouse(字典树Trie)
- ZOJ 1109 Language of FatMouse
- ZOJ1109 Language of FatMouse
- zoj1109 水题(大神绕道) Language of FatMouse
- zoj 1109 : Language of FatMouse
- ZOJ1109 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