uva 10282 Babelfish(映射)
来源:互联网 发布:凯撒博尔吉亚 知乎 编辑:程序博客网 时间:2024/05/23 20:41
此题让我了解了一点map容器,所以说这道题还是我看的题解,以后看的越少越好。。。。
map就是映射,恩,挺好用的,还有就是gets()会读取换行符。。。getchar()也可以,但是scanf()这些
格式化的就读不了。。。会存在于缓冲器内
代码:
#include<stdio.h>#include<iostream>#include<string.h>#include<stdlib.h>#include<string>#include<map>using namespace std;map<string,string>Map;char a[25];char s[25];char d[25];char b[25];void init(){Map.clear();}int main(){int i,j;while(gets(a)){if(a[0] == '\0')break;int len = strlen(a);for(i=0; i<len; i++){if(a[i] == ' ')break;}int k=0; for(j=0; j<i; j++)s[k++] = a[j];k = 0;for(j=i+1; j<len; j++)d[k++] = a[j];Map[d] = s;}while(gets(b)){if(Map.find(b)!=Map.end())cout << Map[b] <<endl;elseputs("eh");}return 0;}
0 0
- uva 10282 Babelfish(映射)
- UVA - 10282 Babelfish(map应用)
- UVa 10282 - Babelfish
- uva 10282 - Babelfish
- uva 10282 - Babelfish
- uva-10282 - Babelfish
- uva 10282 - Babelfish
- UVA 10282 Babelfish
- UVa 10282 - Babelfish
- UVA 10282 - Babelfish
- UVA 10282 Babelfish
- uva 10282 Babelfish
- UVA 10282 - Babelfish
- UVa 10282 - Babelfish
- UVA - 10282 Babelfish
- uva 10282 Babelfish
- uva 10282 Babelfish
- UVA - 10282 Babelfish
- hdoj-2553 n 皇后问题【递归】
- Activiti 10分钟教程
- HTTP协议中PUT和POST使用上的区别
- ExpandLayout用法和封装自定义控件的一些小记
- HTML5桌面通知:notification api
- uva 10282 Babelfish(映射)
- hdu 5348 MZL's endless loop 欧拉回路
- mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file
- hdu4975 网络流及‘删边法’判是否为唯一流
- Java 并发专题 : Semaphore 实现 互斥 与 连接池
- 在Eclipse中使用Jersey和Tomcat构建RESTful WebService及其调用
- Python windows 下 入门操作
- J - Intelligent IME---(2015 summer training #3)
- 虚拟机的优化工具——VMware tools