#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的更多相关文章

  1. 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 ...

  2. hdu 1075 (map)

    http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS ...

  3. hdu 1075 What Are You Talking About

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 题意:比较简单,易懂,这里不做说明. 解法:第一种方法:用map映射,耗时1000+ms:第二种 ...

  4. 字典树 HDU 1075 What Are You Talking About

    http://acm.hdu.edu.cn/showproblem.php?pid=1075 ;}

  5. 题解报告:hdu 1075 What Are You Talking About

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he ...

  6. 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 ...

  7. hdu 1075:What Are You Talking About(字典树,经典题,字典翻译)

    What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K ...

  8. hdu 1075 二分搜索

    还是写一下,二分搜索好了 这道题开数组比较坑... 二分,需要注意边界问题,例如:左闭右闭,左闭右开,否则查找不到or死循环 先上AC代码 #include<iostream> #incl ...

  9. 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 ...

  10. hdu 1075 What Are You Talking About(字典树)

    刚学的字典树,代码写得很不熟练.写法上也没有什么特别的优化,就是以1A为第一目标! 可惜还是失败了. 少考虑了一种情况,就是一个单词是另一个单词前缀的问题,写了好久,还是没有1A.不过感觉对字典树有了 ...

随机推荐

  1. .NET下集中实现AOP编程的框架

    一.Castle 使用这个框架呢,首先是需要安装NuGet包. 先建立一个控制台项目,然后在NuGet中搜索Castle.Windsor,不出意外的话应该能找到如下的包 然后安装,会自动的安装包Cas ...

  2. vijos P1629八 容斥原理

    https://vijos.org/p/1629 注意lcm要用LL 先给一个样例 1 2 1 10 思路.其实这题就是问,给定一堆数,要求不能整除其任意一个的数字有多少个. 容辞 + lcm dfs ...

  3. Webform 内置对象(Response对象、Request对象,QueryString)

    Response对象:响应请求 Response.Write("<script>alert('添加成功!')</script>"); Response.Re ...

  4. javascript动态创建div循环列表

    动态循环加载列表,实现vue中v-for的效果 效果图: 代码: var noApplicationRecord = document.getElementById('noApplicationRec ...

  5. 使用 ArrayAdapter 来定制 ListView

    一个 ListView,其宽高都设为 match_parent,可以更省资源. activity_main.xml <ListView android:id="@+id/list_Vi ...

  6. 在vue中场景,循环行,点击当前行编辑数据

    当前列表 点击编辑,行变为编辑框. <Row style="color:#999;margin-bottom:11px"> <Row style="ma ...

  7. 基于oauth2.0实现应用的第三方登录

    OAuth2 OAuth2所涉及到的对象主要有以下四个: Client 第三方应用,我们的应用就是一个Client Resource Owner 资源所有者,即用户 Authorization Ser ...

  8. hdfs深入:07、hdfs的文件的读取过程

    详细步骤解析 1. Client向NameNode发起RPC请求,来确定请求文件block所在的位置: 2. NameNode会视情况返回文件的部分或者全部block列表,对于每个block,Name ...

  9. vlmcsd-1111-2017-06-17

    Source and binaries: http://rgho.st/6c6R7RwMZ   全部编译好了 https://www.upload.ee/files/7131474/vlmcsd-11 ...

  10. 检查sql对象是否存在

    SQL Server判断对象是否存在   1 判断数据库是否存在 Sql代码  if exists (select * from sys.databases where name = '数据库名')  ...