HDOJ 1075 What Are You Talking About(字典树)

PADS VX2.4 缝合孔(阵列过孔)的添加方法 缝合孔的主要目的是:①:增加底层和顶层的地铜皮的连接性,②:起到屏蔽外界信号干扰的作用。铺完铜后,右击空区域选择“选择形状”命令,选取整板中的一块大铜皮,右击选择“覆铜区域内过孔阵列模式”→“沿周边”指令后,再右击选择“覆铜区域内过孔阵列”,便能看到已选区域内添加的缝合孔(过孔阵列),也可以通过铜皮显示或隐藏的无模命令:PO进行查看。完成上面的“防止错误”和“过孔样式”的设置后,开始对整板进行铺铜处理,点击“工具栏”→覆铜平面指示器,在弹出的对话框点击“开始”,便能观察铺铜后的板子。 阅读详情


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): 14675    Accepted Submission(s): 4720


Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate the history book into English. Can you help him?
 


Input
The problem has only one test case, the test case consists of two parts, the dictionary part and the book part. The dictionary part starts with a single line contains a string "START", this string should be ignored, then some lines follow, each line contains two strings, the first one is a word in English, the second one is the corresponding word in Martian's language. A line with a single string "END" indicates the end of the directory part, and this string should be ignored. The book part starts with a single line contains a string "START", this string should be ignored, then an article written in Martian's language. You should translate the article into English with the dictionary. If you find the word in the dictionary you should translate it and write the new word into your translation, if you can't find the word in the dictionary you do not have to translate it, and just copy the old word to your translation. Space(' '), tab('\t'), enter('\n') and all the punctuation should not be translated. A line with a single string "END" indicates the end of the book part, and that's also the end of the input. All the words are in the lowercase, and each word will contain at most 10 characters, and each line will contain at most 3000 characters.
 


Output
In this problem, you have to output the translation of the history book.
 


Sample Input
  
START from fiwo hello difh mars riwosf earth fnnvk like fiiwj END START difh, i'm fiwo riwosf. i fiiwj fnnvk! END
 


Sample Output
  
hello, i'm from mars. i like earth!
Hint
Huge input, scanf is recommended.


#include<stdio.h>
#include<string.h>
#include<malloc.h>
#define change(n) (n-('a'-0))//把字母变成0~25
#define NUM 26
#define MAX 3000//句子包含的字符长度
struct Trie
{ 
	bool judge;//到该节点是否有单词 
	char s[20];//如果该节点有词,存放该词
	struct Trie *next[NUM];
};
void Build(struct Trie *root,char *c,char *s)
{
	int i,j,k,n,m;
	n=strlen(s);
	struct Trie *p=root;
	for(i=0;i<n;i++)
	{
		m=change(s[i]);
		if(p->next[m]) 
		{
			p=p->next[m];
			continue;
		}
		//-----创建新节点-----// 
		struct Trie *s;
		s=(struct Trie *)malloc(sizeof(struct Trie));
		s->judge=false;
		for(j=0;j<NUM;j++)
		s->next[j]=NULL; 
		//--------------------//
		p->next[m]=s;
		
		p=p->next[m];
	}
	strcpy(p->s,c);
	p->judge=true;
}
void Find(struct Trie *root,char *s)
{
	 int i,j,k,n,m;
	 bool t=false;
	 n=strlen(s);
	 struct Trie *p=root;
	 for(i=0;i<n;i++)
	 {
	 	 m=change(s[i]);
	 	 if(!(p->next[m])) break;
		 if(p->next[m]) 
		 p=p->next[m];  
	 }
	 if(p->judge&&i==n)
	 {
	 	 memset(s,'\0',sizeof(s));
	 	 strcpy(s,p->s);
	 }
}
void Delete(struct Trie *root)
{
	int i;
	for(i=0;i<NUM;i++)
	{
	    if(root->next[i])
	    Delete(root->next[i]);
    }
	free(root);
}
int main()
{ 
    char c[20],s[20];
	int i,j,k;
	//-----建立根节点-----//
	struct Trie *head;
	head=(struct Trie *)malloc(sizeof(struct Trie));
	head->judge=false;
	for(i=0;i<NUM;i++)
	head->next[i]=NULL;
	//--------------------// 
	while(scanf("%s",c)&&strcmp(c,"END")!=0)
	{
	      if(strcmp(c,"START")==0) continue;
	      else
	      scanf("%s",s);
	      
	      Build(head,c,s);
	}//建立Trie树成功 
	
	getchar();
	char list[MAX+10]/*要翻译的句子*/,last[MAX+10];
	int n; 
	while(gets(list))
	{
	     n=strlen(list);
		 if(strcmp(list,"START")==0) continue;
		 else if(strcmp(list,"END")==0) break;
		 
		 memset(last,'\0',sizeof(last));
		 for(i=0,j=0;i<n;)
		 {
		 	if(!(list[i]>='a'&&list[i]<='z'))
			{
			   last[j]=list[i];
			   i+=1;j+=1;
			   continue;
		    }
		    
		    char need[20];//暂时需要 
		    for(k=0;list[i]>='a'&&list[i]<='z';i++,k++)
			need[k]=list[i];
			need[k]='\0';
			Find(head,need);//在Trie查找是否有need 
			strcat(last,need);
			j+=strlen(need); 
		 }
		 puts(last);
	}
	Delete(head);//释放内存 
	
	return 0;
}

HyperLynx(二十二)DDR(五)DDRx总线时序模型设计 DDR3 的数据选通信号与时钟信号的频率是一样的,在数据选通信号写操作时,控制器典型的输出方式是数据选通信号边沿与时钟近似对齐。该界面中显示了所有需要编辑的参数,包括地址/命令信号的时序、控制信号的时序、读和写操作的数据选通和数据信号时序、写操作的数据选通和数据掩码信号时序,以及建立和保持时间的降额参数。由于DDRx总线对时序的要求非常严格,随着速率的提升,时序的要求会更高。反之也是一样的,如果数据选通信号的上升沿在时钟信号上升沿的后面到达 DRAM,那么数据选通信号的下降沿就会在时钟信号的前面到达。 阅读详情

相关推荐

告别音质玄学:实测ACM8625S搭配杰理AC695x,如何通过寄存器精准调出好声音

第一次听到ACM8625S驱动音箱发出的声音时,我有些失望——这个被厂商宣传为"高保真数字功放"的芯片,默认配置下的表现甚至不如一些廉价模拟功放。经过两周的反复调试,最终配置使这款售价不到200元的音箱达到了接近专业监听设备的音质水平。特别是在鼓点和电吉他表现上,既保持了足够的冲击力,又不会掩盖人声细节。例如,当频率响应曲线在10kHz有+2dB提升时,多数评测者认为听感最佳,尽管这会使THD略微增加0.05%。虽然厂商提供的配置工具能快速生成基础代码,但想要获得最佳音效还需要手动优化。

weixin_29655587的博客 359

HDOJ 1075 What Are You Talking About

What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 22065    Accepted Submission(s): 7356 Problem Descriptio

Dust_heart的博客 335

手把手教你用Siemens EDA破解工具搞定PADs VX2.7安装与卡死问题

本文详细介绍了如何使用Siemens EDA工具解决PADs VX2.7的安装与卡死问题。从License配置到性能调优,提供全面的解决方案,帮助工程师高效完成电子设计自动化任务。特别针对常见的卡顿现象,给出了输入法兼容性调整、图形性能优化等实用技巧。

k8l9m0n的博客 576

HDOJ What Are You Talking About

What Are You Talking About http://acm.hdu.edu.cn/diy/contest_showproblem.php?cid=12654&pid=1004 Time Limit : 10000/5000ms (Java/Other)

欢迎 1115

【亲测可用!】阿里达摩院开源实时数字人对话VideoChat本地部署教程(8G显存可跑)

本文主要记录在部署阿里达摩院开源实时数字人对话VideoChat时遇到的问题,希望对各位技术开发或爱好者有所帮助!

波点兔的博客 3927

Solidworks转URDF避坑实录:从履带机器人到ROS仿真的完整配置流程

本文详细介绍了将Solidworks履带机器人模型转换为URDF格式并配置ROS仿真的完整流程,重点解析了坐标系设置、复杂关节定义、插件配置等关键步骤中的常见问题与解决方案,帮助开发者高效实现履带机器人在RVIZ和Gazebo中的精确仿真。

weixin_30693683的博客 459

HDU What Are You Talking About

Time Limit : 10000/5000ms (Java/Other)   Memory Limit : 102400/204800K (Java/Other) Total Submission(s) : 23   Accepted Submission(s) : 12 Problem Description Ignatius is so lucky that he met

海盗船 1049

【ESP32设备通信】-LoRa通信

在本文中,我们将使用 Arduino IDE 将 ESP32 与 LoRa SX1278 (Ra-02) 模块连接起来。 我们将创建一个真实的示例项目,通过 LoRa 无线打开/关闭 LED 进行演示。

视觉与物联智能 1905

HDU 1075 What Are You Talking About

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

Dwylkz 827

六、Tool 工具系统:让大模型拥有“手脚“

我问你一个问题:大模型能不能告诉你"北京今天天气怎么样"?能——它能用非常流畅的中文回答你不能——它不知道这个答案因为它没有联网能力,也没有实时数据。它可能会自信地编一个"今天晴,25 度"给你——这就是幻觉。问题出在哪?大模型是一个"推理引擎",不是一个"执行引擎"。它知道天气 API 怎么调用,但不能真的发出 HTTP 请求。它知道 Python 代码怎么写,但不能真的运行代码。它知道数学公式,但做不了精确的大数计算。Tool 工具系统解决的,就是这个"最后一公里"问题。

牛肉胡辣汤 167

环境配置与基础教程:2026大厂标准:使用 DVC (Data Version Control) 实现 YOLO 数据集版本控制全链路管理

本文介绍了使用DVC 3.0对YOLO数据集进行全链路版本控制的方法。主要内容包括: DVC 3.0的核心增强:内容块级缓存去重、并行云传输、AI智能体元数据跟踪等新特性,可显著提升YOLO数据集管理效率。 环境配置:详细说明DVC 3.0的安装步骤、项目初始化方法以及远程存储配置方案(支持S3、GCS、Azure等多种存储后端)。 目录结构规范:提供符合大厂MLOps标准的项目目录结构设计。 实战操作: 原始数据版本化 多格式标注数据版本控制 版本切换方法 优势说明:DVC通过哈希指针机制管理大型数据集,

ZXSXJ的博客 153

HDOJ 1075 (What Are You Talking About)

点击打开链接 http://acm.hdu.edu.cn/showproblem.php?pid=1075 思路:利用字典树+map ,但是也可以直接利用map来写,用string不要用char 注意:这组数据 START dog aa END START a aa END 输出:a dog 代码(字典树+map): #include &lt;iostre...

编程资料大全 178

在 ABAP 平台上搭建 OAuth 2.0 Server:架构、流程、权限与落地实战

摘要:本文为SAP ABAP开发人员提供将ABAP平台配置为OAuth 2.0授权服务器的实战指南。重点介绍两种授权流程(授权码和SAML Bearer)的实现方案,包括核心事务配置(SOAUTH2/SAML2)、授权对象(S_SCOPE)管理以及端点交互规范。通过具体配置清单和三类典型集成场景(第三方Web应用访问OData、企业集成平台调用、BTP应用对接)的落地示例,帮助读者快速构建安全的OAuth 2.0服务架构。文档强调SSL/TLS基础安全、scope最小授权原则以及授权与令牌端点的标准交互模式

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 319

HDOJ--1075--What Are You Talking About【字典树】

Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it lea

阳光照耀圣西罗 952

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

HDOJ 1075 What Are You Talking About (字典树映射)

What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 17943    Accepted Submission(s): 5836 Problem Description

滴水穿石,慢慢积累,总会有成果 655

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

HDOJ-1075 What Are You Talking About 字典树查找

What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 7414    Accepted Submission(s): 2292 Problem Description Ignati...

weixin_34256074的博客 120

HDOJ-1075 What Are You Talking About 字典树

Description Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. N...

weixin_30381793的博客 89

HDOJ 1075 What are you talking about ? 字典树

加——计算机学院大学生程序设计竞赛(新生为主)  What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 17913    Accepted Submissio

一步一步走 693

HDOJ 题目1075What Are You Talking About(字典树)

What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 13970    Accepted Submission(s): 4499 Problem Descriptio

Jogging_Clown 556

字典树例题介绍:ZOJ 1109 Language of FatMouse,HDOJ 1075hdoj What Are You Talking About

关于字典树,相信还是比较好理解的吧,就是将一次输入中的一些单词,字符串建立成字典。将这些字符每一层存放一个字符,顺序往下查找,在该个字符串(找完该字符串的最后一个字符,即最后一个节点)末尾设置一个节点(一般是存放的东西,比如要翻译过来的单词啊什么的)。 下面来分享两道典型的字典树题: 1.ZOJ 1109 Language of FatMouse:http://acm.zju.edu.cn/o

... 903

HDU/HDOJ 1075 What Are You Talking About(字典树|STL map)

原文地址:http://www.wutianqi.com/?p=2467 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1075 这题用字典树Trie做很麻烦,用STL map要简单多了。 字典树的讲解; http://www.wutianqi.com/?p=1359 这个是网上一位朋友的代码,分别是用字典树和map做的: // 字...

weixin_30484247的博客 150

hdu 1075 What Are You Talking About 字典树

因为没开字符串数组WA到爽。 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1075 #include #include #include #define maxn 30 char a[500050][15]; struct Trie{ Trie * next[maxn]; char * english; }; Tri

NM的专栏 527

入门字典树 HDOJ1251 统计难题 HDOJ1075 字典翻译

HDOJ 1251 统计难题 最简单的字典树,耗内存,对比一下C++和G++下相同的代码运行结果: G++虽然快点,但是直接MLE...所以交的时候还要注意选择编译器啊 #include #include #include #include #include #include #define mst(a,b) memset(a,b,sizeof(a)) using namespace

AgoniAngel 747

hdoj--1075 What Are You Talking About(Trie or map)

hdoj 1075题解map,或者,字典树。#include <iostream> #include <map> #include <string> #include <cctype> #include <cstdio> #include <cstring> using namespace std;//889MS 73424K map<string, string> mp;int main() {

许少y 518

HDOJ 1075 What Are You Talking About(trie树入门)

思路: 字典树:建树,查询。字符串处理稍麻烦点。跑了203MS,还好 #include <iostream> using namespace std; struct node { bool isword; int index; int child[26]; } trie[1000010] ; int size = 0; ...

weixin_30268071的博客 113

解题报告-HDOJ-1075(字典树)

这一题和1251都是字典树,题意是给出单词以及单词的翻译,最后让你用这些单词翻译给出来的语句。 我的思路是,在每一个flag为true的单词保存对应的翻译,当翻译句子时,搜索字典树,当找到该单词、flag为true、并且该单词已经结束(很重要),就输出对应的翻译,否则,输出原来的单词。 以下是实现代码: #include using namespace std; char str[30

勤奋也是一种天赋 1208
上一篇: HDOJ 1671 Phone List(字典树)
下一篇: HDOJ 1251 统计难题(字典树)
SimonCoder
博客等级 码龄13年 1413粉丝 231原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址