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.不过感觉对字典树有了 ...
随机推荐
- 树莓派 VNC 远程桌面 同一个桌面
如何在ssh登录的情况下配置好vino 1.传输文件 2.ssh sudo dpkg -i ~/swap/deb/tight* sudo cp ~/swap/vino.desktop /etc/xdg ...
- ASP.NET Excel下载方法一览
方法一 通过GridView(简评:方法比较简单,但是只适合生成格式简单的Excel,且无法保留VBA代码),页面无刷新 aspx.cs部分 using System; using System.Co ...
- MAC 添加共享,脚本执行
Linux需要首先安装 yum install samba-client linxu添加windows 公共盘 mount -t cifs user=guest,password=guest // ...
- 迅为工业级arm开发板i.MX6DL开发板软件硬件全开源
i.MX6是基于ARM Cortex™-A9架构的高扩展性多核系列应用处理器,促进了如高稳定性工业平板电脑.差异化智能本.前装车载中控系统和超高清电子书阅读器等新一代应用的发展.强劲的3D图形加速引擎 ...
- idea 常用操作
1.创建的maven项目,java文件不提示错误:有main方法但右击却找不到run选项的问题 1)首先要配置SDK--就是配置JDK 2)然后要按照提示信息导入某些maven相关的东西,就这个Eve ...
- CAD使用SetxDataString写数据(com接口)
主要用到函数说明: MxDrawEntity::SetxDataString 写一个字符串扩展数据,详细说明如下: 参数 说明 [in] BSTR val 字符串值 szAppName 扩展数据名称 ...
- 他山之石:D3DX书籍推荐
一.DirectX9.0.3D游戏开发编程基础(龙书) 这本书网上评论很好,当初作为入门书看确实还不错,但是看得有点稀里糊涂的.现在回过头来看,它有些地方省略了,所以还得自己多多总结,总得来说还是值得 ...
- SQL SERVER系统表和常用函数介绍
sysaltfiles 主数据库 保存数据库的文件 syscharsets 主数据库 字符集与排序顺序sysconfigures 主数据库 配置选项syscurconfigs 主数据库 当前配置选项s ...
- [转载]C++、C#写的WebService相互调用
[转载]C++.C#写的WebService相互调用 首先感谢永和兄提供C++的WebService服务器端及客户端,并且陪我一起熬夜:然后是火石和我做接口的兄弟,虽然都不知道你叫什么,如果没有你 ...
- JFinal项目eclipse出现the table mapping of model: com.gexin.model.scenic.Scenic not exists or the ActiveRecordPlugin not start.
JFinal项目eclipse出现the table mapping of model: com.gexin.model.scenic.Scenic not exists or the ActiveR ...