hdu 1075 (map)
http://acm.hdu.edu.cn/showproblem.php?pid=1075
What Are You Talking About
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Java/Others)
Total Submission(s): 13618 Accepted Submission(s): 4366
Huge input, scanf is recommended.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <map> using namespace std; int main()
{
char str1[],str2[],str3[];
map<string ,string >m;
map<string ,string >::iterator it;
scanf("%*s");
while(scanf("%s",str2)!=EOF&&str2[]!='E')
{
scanf("%s",str3);
m[str3]=str2;
}
scanf("%*s");
getchar();
while(cin.getline(str1,)&&str1[]!='E')//遇到换行停止
{
int step=;
memset(str2,'\0',sizeof(str2));
for(int i=;i<strlen(str1);i++)
{
if(str1[i]<'a' || str1[i]>'z')
{
if(step)
{
it=m.find(str2);
if(it != m.end())
{
cout<<it->second;
}
else
{
printf("%s",str2);
}
step=;
memset(str2,'\0',sizeof(str2));
}
cout<<str1[i];
}
else
str2[step++]=str1[i];
}
puts("");
//printf("\n");
}
return ;
}
hdu 1075 (map)的更多相关文章
- hdu 1075 map的使用 字符串截取的常用手段 以及string getline 使用起来的注意事项
首先说字符串的截取套路吧 用坐标一个一个的输入 用遍历的方式逐个去检查字符串中的字符是否为符合的情况 如果是的话 把该字符放入截取string 中 让后坐标前移 如果不是的话 截取结束 坐标初始化 然 ...
- HDU 1075 What Are You Talking About(Trie的应用)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- HDOJ/HDU 1075 What Are You Talking About(字符串查找翻译~Map)
Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn't know the lan ...
- HDU 1075 What Are You Talking About (stl之map映射)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- HDU 1075 字符串映射(map)
Sample InputSTARTfrom fiwohello difhmars riwosfearth fnnvklike fiiwjENDSTARTdifh, i'm fiwo riwosf.i ...
- hdu 1075 What Are You Talking About(map)
题意:单词翻译 思路:map #include<iostream> #include<stdio.h> #include<string.h> #include< ...
- hdu 1075 What Are You Talking About(map)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- hdu 1075 What Are You Talking About
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 题意:比较简单,易懂,这里不做说明. 解法:第一种方法:用map映射,耗时1000+ms:第二种 ...
- 题解报告:hdu 1075 What Are You Talking About
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he ...
随机推荐
- UIImageView(转)
UIImageView,顾名思义,是用来放置图片的.使用Interface Builder设计界面时,当然可以直接将控件拖进去并设置相关属性,这就不说了,这里讲的是用代码. 1.创建一个UIImage ...
- Delphi 取得桌面文件夹的路径和取得我的文档的路径
Uses Windows,Registry; function GetShellFolders(strDir: string): string; const regPath = '\Software\ ...
- V4L2应用程序框架-二【转】
本文转载自:http://blog.csdn.net/tommy_wxie/article/details/11371439 V4L2驱动框架 主设备号: 81 次设备号: 0-63 64 ...
- 161110、彻底征服 Spring AOP 之 实战篇
Spring AOP 实战 看了上面这么多的理论知识, 不知道大家有没有觉得枯燥哈. 不过不要急, 俗话说理论是实践的基础, 对 Spring AOP 有了基本的理论认识后, 我们来看一下下面几个具体 ...
- C# Driver LINQ Tutorial
1.介绍 该教程涵盖了1.8版本的C#驱动中的LINQ查询.你可能已经阅读最新的C# Driver Tutorial. 2.快速开始 首先,给程序添加下面的using声明 using MongoDB. ...
- plsql日期乱码
乱码状况如截图: 控制面板\所有控制面板项\系统\高级系统设置\环境变量, 设置系统变量,变量名:NLS_LANG,变量值:Simplified Chinese_China.AL32UTF8改为SIM ...
- Redis的使用完整版
[Redis基本] 1.redis安装完成后的几个文件: redis-benchmark 性能测试工具(批量写入)./bin/redis-benchmark -n 10000 即可一次性写入100 ...
- require()与 require_once()、 include与include_once()
- JAVA字段的初始化规律
JAVA字段的初始化规律 1.类的构造方法 (1)“构造方法”,也称为“构造函数”,当创建一个对象时,它的构造方法会被自动调用.构造方法与类名相同,没有返回值. (2)如果类没有定义构造函数,Java ...
- python中string.casefold和string.lower区别
string.casefold和string.lower 区别 python 3.3 引入了string.casefold 方法,其效果和 string.lower 非常类似,都可以把字符串变成小写, ...