POJ 2503 Babelfish STL-map容器
2017-01-19 11:23
477 查看
传送门:POJ 2503 Babelfish
分析:
利用map容器的键值属性对,通过键高效查找值。
代码如下:
分析:
利用map容器的键值属性对,通过键高效查找值。
代码如下:
#include <iostream> #include <cstdio> #include <map> #include <string> using namespace std; int main() { int i; char str[25],a[12],b[12]; map<string,string> m; while(gets(str) && str[0]) { sscanf(str,"%s%s",a,b); m[b] = a; } while(scanf("%s",str) != EOF) { if(m[str].size()) // 如果找到了m[str] cout << m[str] << endl; else cout << "eh" << endl; } return 0; }
相关文章推荐
- POJ2503 Babelfish map做法
- POJ Babelfish 2503(map,字典树)
- UVa 10282 / POJ 2503 Babelfish / ZOJ 1109 Language of FatMouse (STL&map)
- poj 2503 Babelfish(hash or 字典树)
- STL之map——解决POJ 2503
- poj Babelfish(二分||map)
- poj Babelfish(二分||map)
- Babelfish poj 2503 映射 sscanf
- poj Babelfish(二分||map)
- poj Babelfish(二分||map)
- poj Babelfish(二分||map)
- poj 2503 Babelfish Trie
- POJ 2503 Babelfish qsort+bserach
- poj Babelfish(二分||map)
- STL之map——解决POJ 2503
- POJ 2503 Babelfish // 字符串映射,Trie
- hash Babelfish poj 2503
- Poj 2503 Babelfish//Trie树
- poj Babelfish(二分||map)
- poj Babelfish(二分||map)