HDU1075 What Are You Talking About
2016-02-21 23:27
453 查看
本题用到的是STL中的map 函数,,,借助了kuangbin大神的帮助。。。
代码如下,,,自己看吧。
代码如下,,,自己看吧。
/* HDU 1075 */ #include<stdio.h> #include<algorithm> #include<iostream> #include<string> #include<map> #include<string.h> using namespace std; map<string,string>mp; int main() { mp.clear(); string str1,str2; cin>>str1; while(cin>>str1) { if(str1=="END")break; cin>>str2; mp[str2]=str1; } cin>>str1; char ch; ch=getchar(); str1=""; while(1) { while(1) { scanf("%c",&ch); if(!((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')))break; str1+=ch; } if(str1=="END")break; if(mp.find(str1)==mp.end())cout<<str1; else cout<<mp[str1]; str1=""; printf("%c",ch); } return 0; }
相关文章推荐
- 利用python求解八数码难题
- PAT--1013 Battle Over Cities(并查集)
- TCP/IP、Http、Socket的区别
- JAVA语法基础
- 解密回声消除技术之二(应用篇)
- neuq oj 1052: 谭浩强C语言(第三版)习题6.8 C语言
- C和指针思想精髓
- [MyBatis日记]问题汇总
- Swift基础语法&&入门教程_字符串,数组_字典
- git push warning: push.default is unset 分析解决
- Conversion to Dalvik format failed with error 1
- MySQL 主从复制与读写分离概念及架构分析
- nyoj 123 士兵杀敌四
- C语言运算符优先级详细列表
- 自定义浏览器弹窗
- [java]_[线程池的使用]
- 中值滤波 matlab实现
- C++面向对象编程<三>:操作符重载
- 身份证号码工具类
- MySQL 启动时禁用了 InnoDB 引擎的解决方法