HDOJ-1075What Are You Talking About(Trie/Map)
来源:互联网 发布:java计算器加减乘除 编辑:程序博客网 时间:2024/05/15 03:54
虽然是Trie专题里面的,不过完全可以用MAP写,于是就用MAP写了一发。自己的字符串处理还是不行,写得太烂了。
#include <cstdio>#include <cstdlib>#include <cstring>#include <map>#include <string>#include <iostream>using namespace std;int main(){ map <string,string>f; string str1,str2; char s[10000]; int i; f.clear(); gets(s); while(scanf("%s",s),strcmp(s,"END")) { str1=s; scanf("%s",s); str2=s; f[str2]=str1; } getchar(); gets(s); while(gets(s),strcmp(s,"END")) { str1=""; for(i=0;i<=strlen(s);i++) { if(s[i]>='a' && s[i]<='z' && i<strlen(s)) { str1+=s[i]; } else { if(f.count(str1)) cout<<f[str1]; else cout<<str1; if(i<strlen(s))cout<<s[i]; str1=""; } } cout<<endl; } return 0;}
0 0
- HDOJ-1075What Are You Talking About(Trie/Map)
- hdoj--1075 What Are You Talking About(Trie or map)
- HDOJ 1075 -- What Are You Talking About Trie( STL )
- HDU- 1075 What Are You Talking About (Trie or map)
- Hdoj 1075 What Are You Talking About 【MAP】
- hdoj 1075 What Are You Talking About 【STL map+string】
- HDOJ 1075 What are you talking about (map + 字符串 )
- HDOJ.1075 What Are You Talking About(map)
- HDOJ 1075 What Are You Talking About
- HDOJ What Are You Talking About 1075
- HDOJ 1075 What Are You Talking About
- What Are You Talking About(trie树或map)
- HDU 1075 What Are You Talking About (map解法+Trie解法)
- hdu 1075What Are You Talking About(map或trie)
- hdu 1075 What Are You Talking About Trie树
- HDU 1075 What Are You Talking About Trie题解
- hdu 1075 What Are You Talking About 字典树 trie
- HDU 1075 What Are You Talking About Trie
- 【数据结构】回顾优先队列(堆)
- ubuntu Django安装
- HDU 1020 at Sun
- 如何在linux下安装应用程序qq
- acdream 1726 A Math game
- HDOJ-1075What Are You Talking About(Trie/Map)
- vi/vim学习
- 面试问题总结(一)
- MVC,MVP 和 MVVM 的图示
- PATH 环境变量
- HDU 2859 Phalanx
- Ubuntu 安装 Visual Studio Code
- 四旋翼飞行器 四元数和欧拉角的关系 与 姿态解算
- BC-40 HDU5225 HDU 5226 【水】