hdu 1075 map
生活随笔
收集整理的這篇文章主要介紹了
hdu 1075 map
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題意:給一個字典,和一句話,翻譯一下
奇怪的格式
Sample Input START from fiwo hello difh mars riwosf earth fnnvk like fiiwj END START difh, i'm fiwo riwosf. i fiiwj fnnvk! END Sample Output hello, i'm from mars. i like earth! 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cstring> 5 #include<cmath> 6 #include<queue> 7 #include<map> 8 using namespace std; 9 #define MOD 1000000007 10 const double eps=1e-5; 11 #define cl(a) memset(a,0,sizeof(a)) 12 #define ts printf("*****\n"); 13 const int MAXN=1005; 14 map<string,string> mp; 15 int n,m,tt; 16 int main() 17 { 18 int i,j,k; 19 #ifndef ONLINE_JUDGE 20 freopen("1.in","r",stdin); 21 #endif 22 string str1,str2; 23 cin>>str1; 24 while(cin>>str1) 25 { 26 if(str1=="END") break; 27 cin>>str2; 28 mp[str2]=str1; 29 } 30 cin>>str1; 31 char ch; 32 ch=getchar(); 33 str1=""; 34 while(1) 35 { 36 while(1) 37 { 38 scanf("%c",&ch); 39 if(!((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))) break; 40 str1+=ch; 41 } 42 if(str1=="END") break; 43 if(mp.find(str1)==mp.end()) cout<<str1; //并未在字典中找到 44 else cout<<mp[str1]; 45 str1=""; 46 printf("%c",ch); //符號或空格 47 } 48 return 0; 49 }?
轉載于:https://www.cnblogs.com/cnblogs321114287/p/4433702.html
總結
以上是生活随笔為你收集整理的hdu 1075 map的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于API与GPU
- 下一篇: IOS开发学习笔记011-xcode使用