hdu 1075
#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
map<string,string>mymap;
int main() {
int i,j,k,n,m;
char s[4000],str[30],str2[30];
string str1;
scanf("%s",str);
while(scanf("%s",str),strcmp(str,"END")) {
scanf("%s",str2);
mymap[str2]=str;
}
getchar();
gets(s);
while(gets(s),strcmp(s,"END")) {
k=0;
for(i=0;s[i];i++)
if(s[i]>='a'&&s[i]<='z')
str[k++]=s[i];
else {
if(k==0) {
printf("%c",s[i]);
continue;
}
str[k++]=0;
str1=mymap[str];
strcpy(str2,str1.c_str());//或者直接进行长度比较str1.length();
if(strlen(str2)==0)
printf("%s",str);
else
cout<<str1;
printf("%c",s[i]);
k=0;
}
printf("\n");
}
return 0;
}
hdu 1075的更多相关文章
- 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 ...
- hdu 1075 (map)
http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS ...
- 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 ;}
- 题解报告:hdu 1075 What Are You Talking About
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he ...
- 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 ...
- hdu 1075:What Are You Talking About(字典树,经典题,字典翻译)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- hdu 1075 二分搜索
还是写一下,二分搜索好了 这道题开数组比较坑... 二分,需要注意边界问题,例如:左闭右闭,左闭右开,否则查找不到or死循环 先上AC代码 #include<iostream> #incl ...
- 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(字典树)
刚学的字典树,代码写得很不熟练.写法上也没有什么特别的优化,就是以1A为第一目标! 可惜还是失败了. 少考虑了一种情况,就是一个单词是另一个单词前缀的问题,写了好久,还是没有1A.不过感觉对字典树有了 ...
随机推荐
- html 测试
斯蒂芬斯蒂芬 20:23你过来吧,我们好好谈一谈 好好学习 21:22这是一个无法避免的错误 作为一个新手,我在学习HTML文件的格式,我觉得博客园的编辑器很棒, 查看这些源代码让我学习到了许多知识. ...
- java数组实现买彩票(二个一维数组的比较思想)
/** 设计一个程序,模拟从彩球池里随机抽取5个彩球(彩球池里一共有11个彩球,编号为1~11), 要求在控制台打印出这5个被取出来的彩球的编号(注意编号不能重复). 思路: 1.创建一个int类型的 ...
- UnixTime的时间戳的转换
public static string XConvertDateTime(double unixTime) { System.DateTime time = System.DateTime.MinV ...
- 如何用 CSS 绘制各种形状
自适应的椭圆 1.自适应的椭圆 实现方式是通过border-radius这个属性:border-radius它可以单独指定水平和垂直半径.用 / 分隔这两个值.并且该属性的值不仅可以接受长度值,还能接 ...
- org.apache.tomcat.util.net.NioEndpoint,打开的文件过多
错误信息: 27-Mar-2019 04:20:20.430 严重 [http-nio-8100-Acceptor-0] org.apache.tomcat.util.net.NioEndpoint$ ...
- ERStudio8.0 破解版 下载
下面地址亲测有效 https://blog.csdn.net/weixin_37139761/article/details/83856069
- CAD参数绘制圆(com接口)
CAD绘制图像的过程中,画圆的情况是非常常见的,用户可以设置圆的圆心位置及半径属性. 主要用到函数说明: _DMxDrawX::DrawCircle 绘制一个圆.详细说明如下: 参数 说明 DOUBL ...
- 08CSS边框边距
CSS边框边距 边框样式——border-style border-top-style border-bottom-style border-left-style border-right-style ...
- zabbix4.2学习笔记--监控nginx
图解一个客户端连接开源版本的Nginx情况 Accepts(接受).Handled(已处理).Requests(请求数)是一直在增加的计数器.Active(活跃).Waiting(等待).Readin ...
- 第3节 hive高级用法:16、17、18
第3节 hive高级用法:16.hive当中常用的几种数据存储格式对比:17.存储方式与压缩格式相结合:18.总结 hive当中的数据存储格式: 行式存储:textFile sequenceFile ...