What Are You Talking About

点我

Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into English. Can you help him?
Input
The problem has only one test case, the test case consists of two parts, the dictionary part and the book part. The dictionary part starts with a single line contains a string "START", this string should be ignored, then some lines follow, each line contains two strings, the first one is a word in English, the second one is the corresponding word in Martian's language. A line with a single string "END" indicates the end of the directory part, and this string should be ignored. The book part starts with a single line contains a string "START", this string should be ignored, then an article written in Martian's language. You should translate the article into English with the dictionary. If you find the word in the dictionary you should translate it and write the new word into your translation, if you can't find the word in the dictionary you do not have to translate it, and just copy the old word to your translation. Space(' '), tab('\t'), enter('\n') and all the punctuation should not be translated. A line with a single string "END" indicates the end of the book part, and that's also the end of the input. All the words are in the lowercase, and each word will contain at most 10 characters, and each line will contain at most 3000 characters.
Output
In this problem, you have to output the translation of the history book.
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!

 
一道翻译转换题,学会了map使用。
 1 #include<iostream>
 2 #include<map>
 3 #include<cstdio>
 4 #include<algorithm>
 5 #include<string>
 6 #include<cstring>
 7 using namespace std;
 8 int main()
 9 {
10     map<string,string>mp;
11     int i=0,j,k;
12     char s1[15],s2[15];
13     char a[11];
14     char ch;
15     char buf[15];
16    // freopen("in.txt","r",stdin);
17     gets(a);
18     while(scanf("%s",s1))
19     {
20         if(0==strcmp(s1,"END"))
21             break;
22         else
23         {
24              scanf("%s",s2);
25              mp[s2]=s1;
26         }
27     }
28     getchar();
29     gets(a);
30     while(scanf("%c",&ch)==1)
31     {
32         if(isalpha(ch))
33         {
34             buf[i++]=ch;
35         }
36         else
37         {
38             buf[i]='\0';
39             i=0;
40             if(strcmp(buf,"END")==0)
41                 break;
42             if(mp.find(buf)!=mp.end())
43                 cout<<mp[buf];
44             else
45                 printf("%s",buf);
46             printf("%c",ch);
47         }
48
49     }
50     return 0;
51 }

转载于:https://www.cnblogs.com/a1225234/p/4548858.html

翻译题(map使用)相关推荐

  1. 大英赛C类翻译题合集

    大英赛C类翻译题合集 2012初赛 2013初赛 2013决赛 2014初赛 2014决赛 2012初赛 既然没有退路了,我们不妨试试他的方法.(might as well) Since there ...

  2. ap计算机科学考题,把AP计算机A Free Response题做成阅读理解理解翻译题

    原标题:把AP计算机A Free Response题做成阅读理解理解翻译题 AP CSA 简答题简介 APCSA计算机考试历来是申请美校Computer Science专业的敲门砖,它在众多AP考试中 ...

  3. 计算机的广泛应用让我们摆脱了很多文书工作,英语汉英翻译题.doc

    英语汉英翻译题 第一单元 1.The problem is that the line between when to spellcheck and poorfread and when to jus ...

  4. 计算机专英语第6版翻译10.2,2010年6月英语六级翻译题模拟训练附答案 第2期

    翻译练习 2010年6月英语六级翻译题模拟训练附答案 第2期 不定式 1) It was a great achievement _______________(10个月建成一栋24层的楼). 2) ...

  5. 教你如何做大学英语四级翻译题!!!英语四级翻译必备分类词汇和练习题以及模板

    文章目录: 补充:英语四级常用web 一:翻译必备知识点 二:翻译评分标准 三:英语四级翻译题怎么做 四:英语四级翻译必备分类词汇 路径1:8种 路径2:16种 路径3:10种 路径4:18种 路径5 ...

  6. 大二上期计算机试题答案,英语综合教程3(大二上期),课后翻译题答案

    英语综合教程3(大二上期),课后翻译题答案,这个是我们内江师范学院英语教材上的课后翻译,希望对大家的学习能有所帮助! 全新版大学英语 综合教程3大二上期 课后翻译题答案 P21-22 Unit 1 1 ...

  7. 2021年12月 CET4/6 翻译题猜测

    目录 2021年12月 CET4/6 翻译题猜测 一.黄果树瀑布 原文: 译文: 二.中国菜 原文: 译文: 三.长沙 原文: 译文: 四.上海博物馆 原文: 译文: 五.北京旅游 原文: 译文: 2 ...

  8. 职称考试需要计算机英语翻译,职称英语考试翻译题解题指南(1)

    英汉句式特点 英语和汉语是完全不同的两种语言.英语属印欧语系,汉语属汗藏语系,两种语言差异很大.翻译不是英语单词与汉字的对译,而是两种语言的语段动态对译.成功的译文应在意义上与原文等值,再遣词造句上看 ...

  9. 她没有你会使用计算机英语,2017中考英语句子翻译题解题方法加真题演练附答案...

    下面的内容,都是官方语言,我很少在课上这样讲解翻译题. 这里只是想作为参考让同学们系统的了解下中考英语翻译问题. 我对翻译的理解是:语法+词汇,短语,句型.然后不要自己去编造句子. 而是大量的输入固定 ...

  10. 国家开放大学计算机专业英语翻译,最新国家开放大学电大《管理英语3》形考翻译题试题及答案...

    最新国家开放大学电大<管理英语3>形考翻译题试题及答案 请选择下列句子正确的翻译. 题目26 They are so unusual both in their talents and t ...

最新文章

  1. 数据结构与算法之美day 6: 如何实现LRU缓存淘汰算法?
  2. VMWare常用快捷键
  3. 【计算机类】大学生计算机专业常用工具汇总
  4. eclipse new creation file type
  5. Linux16.04配置CUDA8.0+CUDNNV5.1
  6. 抓屏的各种方法(http://www.codeproject.com/KB/dialog/screencap.aspx)
  7. Final Michael Scofield
  8. hook控制浏览器的方法_Java-Hook技术-入门实践+反射、动态代理、热修复再看看
  9. JavaScript:学习笔记(7)——VAR、LET、CONST三种变量声明的区别
  10. Spring Boot 集成Shiro和CAS
  11. ide进行php编程快捷键,PHP IDE phpstorm 快捷键
  12. 伺服驱动器cn1引脚定义_伺服驱动器CN1引脚定义,和面板操作设置,跪求高手指点。说明书弄丢了.脉冲,使能,方向,接第几引脚...
  13. 量化交易入门阶段——欧奈尔的CANSLIM模型(C 季度每股收益增长)
  14. android sdk 配置出错error: unknown argument --licenses
  15. 当你心情不好的时候,看看这几句话。。。
  16. PS文字调整为复印字效果
  17. 如何从外网SSH访问家中的树莓派?
  18. FPS游戏外挂屡禁不止,如何破局?
  19. L1-044 稳赢 (15分)
  20. 梦幻般仙境mac动态壁纸

热门文章

  1. 软件架构设计案例_透过现象看本质:常见的前端架构风格和案例
  2. vue @input带参数_Vue 全家桶开发的一些小技巧和注意事项
  3. LeetCode 1203. 项目管理(两次拓扑排序)
  4. LeetCode 778. 水位上升的泳池中游泳(二分查找+dfs)
  5. LeetCode 686. 重复叠加字符串匹配
  6. python书籍_Python书籍大汇总——入门到实战
  7. python中装饰器的参数与返回值
  8. oracle加密可以跟java一致吗,在GBase 8s上使用java udr实现Oracle兼容的加密解密功能...
  9. openstack实例状态错误_Openstack虚机操作总结
  10. 超一流 | 从XLNet的多流机制看最新预训练模型的研究进展