HDU 1075 - What Are You Talking About
Posted nicetomeetu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 1075 - What Are You Talking About相关的知识,希望对你有一定的参考价值。
map 写了一遍,表示基本功非常不扎实。
1 #include <iostream> 2 #include <string> 3 #include <map> 4 using namespace std; 5 map<string,string> mp; 6 string s,s2; 7 char c; 8 int cnt; 9 int main() 10 { 11 cnt=0; 12 while(cin>>s) 13 { 14 if(s=="START") continue; 15 if(s=="END") break; 16 cin>>s2; 17 mp[s2]=s; 18 } 19 cin>>s; 20 s.clear(); 21 scanf("%c",&c); 22 while((c=getchar())!=EOF) 23 { 24 if(isalpha(c)) 25 { 26 s+=c; 27 } 28 else { 29 if(s=="END") break; 30 if(mp.find(s)!=mp.end()) 31 { 32 cout<<mp[s]; 33 s.clear(); 34 } else{ 35 cout<<s; 36 s.clear(); 37 } 38 cout<<c; 39 } 40 } 41 }
以上是关于HDU 1075 - What Are You Talking About的主要内容,如果未能解决你的问题,请参考以下文章
HDU 1075 What Are You Taking About
hdu 1075 What Are You Talking About
hdu 1075 What Are You Talking About (map)
HDU 1075 What Are You Talking About (Trie)