HDU 1075-What Are You Talking About(map)
2014-11-23 19:06
519 查看
题目链接:传送门
字典树。。
题意:给以部字典,英文和火星文对照的,再给一篇火星文,要求把火星文翻译成英文(字典中没有的火星文直接原样输出)
map水过。。
字典树。。
题意:给以部字典,英文和火星文对照的,再给一篇火星文,要求把火星文翻译成英文(字典中没有的火星文直接原样输出)
map水过。。
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <string> #include <cctype> #include <vector> #include <cstdio> #include <cmath> #include <queue> #include <stack> #include <map> #include <set> #define maxn 360 #define _ll __int64 #define ll long long #define INF 0x3f3f3f3f #define Mod 1000000007 #define pp pair<int,int> #define ull unsigned long long #define max(x,y) ( ((x) > (y)) ? (x) : (y) ) #define min(x,y) ( ((x) > (y)) ? (y) : (x) ) using namespace std; char str[3010]; int main() { map <string,string> m; char x[12],y[12],word[12]; scanf("%s",x); while(~scanf("%s",x)&&x[0]!='E') { scanf("%s",y); string ta(x),tb(y); m[y]=x; } scanf("%s",x);getchar(); while(gets(str)&&str[0]!='E') { int len=strlen(str),i=0; while(i<len) { if(str[i]<'a'||str[i]>'z') { putchar(str[i++]); continue; } int p=0; while((str[i]>='a'&&str[i]<='z')&&i<len) word[p++]=str[i++]; word[p]='\0'; string sb(word); if(m.count(sb)) printf("%s",m[sb].c_str()); else printf("%s",word); } puts(""); } return 0; }
相关文章推荐
- hdu 1075 What Are You Talking About(map)
- HDU 1075 What Are You Talking About 【map + find】
- hdu 1075-What Are You Talking About(Map&&字典树)
- hdu 1075 What Are You Talking About(map)
- HDU-1075 What Are You Talking About(map)
- (HDU)1075 - What Are You Talking About【字典树】or【字符串map】
- HDU-1075-What Are You Talking About(字典树&map)
- HDOJ/HDU 1075 What Are You Talking About(字符串查找翻译~Map)
- HDU- 1075 What Are You Talking About (Trie or map)
- HDU 1075 What Are You Talking About (map 或者 字典树)
- hdu 1075 What Are You Talking About< map<string,string> >
- hdu 1075 What Are You Talking About(map)
- HDU 1075 What Are You Talking About (map解法+Trie解法)
- HDU 1075.What Are You Talking About【Map水题(字典树)】【5月25】
- HDU 1075 What Are You Talking About(用map进行翻译)
- HDU 1075 What Are You Talking About(map运用)
- HDU 1075 What Are You Talking About(map映照容器)(搜索)
- HDU-1075 What Are You Talking About (STL:map)
- hdu 1075 What Are You Talking About map
- HDOJ/HDU 1075 What Are You Talking About(字符串查找翻译~Map)