题目地址:POJ 2503

题意:输入一个字典。字典格式为“英语 外语”的一一映射关系然后输入若干个外语单词。输出他们的 英语翻译单词,假设字典中不存在这个单词,则输出“eh”。

思路:用map存取外语和英语的映射关系,然后找就好了。注意输入格式。

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <map>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef __int64 LL;
const int inf=0x3f3f3f3f;
const double pi= acos(-1.0);
const double esp=1e-7;
map<string,string>mp;
char str1[110],str2[110],str[110];
int main()
{
int n;
mp.clear();
while(1){
gets(str);
if(!strcmp(str,"")) break;
sscanf(str,"%s%s",str1,str2);
mp[str2]=str1;
}
while(~scanf("%s",str)){
if(mp.find(str)==mp.end())
puts("eh");
else
printf("%s\n",mp[str].c_str());//c_str是直接返回一个以/0结尾的字符串,仅仅能使用一次。
}
return 0;
}

$(function () {
$('pre.prettyprint code').each(func

最新文章

  1. Android架构:用消息机制获取网络数据
  2. hduoj 4707 Pet 2013 ACM/ICPC Asia Regional Online —— Warmup
  3. Win异常: 除了chrome浏览器外,所有安装的软件都连不上网
  4. [Powershell] FTP Download File
  5. Chapter 1 Securing Your Server and Network(5):使用SSL加密会话
  6. MIP 技术进展月报:储存功能全新上线,MIP-Cache域名升级,校验更严谨
  7. tomcat7启动闪退
  8. content-box和border-box
  9. Django(框架、模板)
  10. Bitbox : a small open, DIY 32 bit VGA console
  11. log4j MDC用户操作日志追踪配置
  12. Packet for query is too large (5,145 &gt; 1,024). You can change this value on the server by setting the &#39;max_allowed_packet&#39; variable.
  13. BufferedInputStream 缓冲输入字节流 -------上
  14. 南昌邀请赛网络赛 D.Match Stick Game(dp)
  15. 推进&quot;五通一平&quot;:手淘技术&quot;三大容器 五大方案&quot;首次整体亮相 百川开放升级
  16. angular学习笔记(九)-css类和样式3
  17. centos 安装php扩展的两种方法
  18. 东东糖博客MYSQL
  19. 一个jquery-ajax post例子ajax 登陆
  20. 《锋利的JQuery》读书要点笔记2——DOM操作

热门文章

  1. Codeforces Round #352 (Div. 2) C
  2. js加解密的算法
  3. xmlSerializer属性的使用
  4. DataTable 去重合并
  5. (转)MSI - Enable MSI Logging
  6. vmware上搭建kickstart 网络安装centos6.2的过程
  7. springBoot Ribbon Hystrix
  8. App接口加密解密方法
  9. Codeforces Round #446 (Div. 2) A. Greed【模拟】
  10. Python的网络编程[2] -&gt; TFTP 协议[1] -&gt; TFTP 的 Python 实现