hdu4287Intelligent IME 字典树

EMB电子机械制动执行器五大核心部件选型解析 本文介绍了EMB电子机械制动执行器五大核心部件的选型方案:采用无刷直流电机作为驱动源,兼具高扭矩和快速响应特性;选用滚珠丝杠传动机构,实现高效旋转-直线转换;行星齿轮减速器满足紧凑空间内的增扭需求;QT450-QT550材质的钳体确保刚度要求;应变片式压力传感器实现夹紧力精确测量。各部件选型综合考虑了性能、可靠性和空间限制,为EMB系统设计提供了完整解决方案。 阅读详情

思路:把后面的字符串转换为数字加入到字典树中,然后再重新检索一下原来的数字的个数

注意:由于有多个实例,所以每个实例结束后必须清空一下字典树

#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define NSIZ 5010
#define WS   100
#define N    8
char words[NSIZ][N];
typedef struct Node_
{
	struct Node_ * next[10];
	int    isWord;
	int    id;
	Node_()
	{
		for (int i = 0;i < 10; i++)
		{
			next[i] = 0;
		}
		isWord = 0;
		id = -1;
	}
}Node;
Node * root = 0;
int m_hash[256];
bool InsertTree(char * word)
{
	if (!word || word[0] == 0)
	{
		return 0;
	}
	if (!root)
	{
		root = new Node();
	}
	int i = 0, locate = 0, n = strlen(word);
	Node * tmp = root;
	for (i = 0;i < n; ++i)
	{
		locate = word[i] - '0';
		if (tmp->next[locate] == 0)
		{
			tmp->next[locate] = new Node();
		}
		tmp = tmp->next[locate];
	}
	tmp->isWord++;
	return 0;
}

int SearchTree(char * word)
{
	if (!word || word[0] == 0 || !root)
	{
		return 0;
	}
	int i = 0, locate = 0, n = strlen(word);
	Node * tmp = root;
	for (i = 0;i < n; ++i)
	{
		locate = word[i] - '0';
		if (tmp->next[locate] == 0)
		{
			printf("0\n");
			return 0;
		}
		tmp = tmp->next[locate];
	}
	printf("%d\n", tmp->isWord);
	return 1;
}
bool DeleteTree(Node * root)
{
	if (!root)
	{
		return 0;
	}
	int i = 0;
	for (i  = 0;i < 26; ++i)
	{
		if (root->next[i] == 0)
		{
			Node * tmp = root->next[i];
			DeleteTree(tmp);
		}
	}
	if (root)
	{
		delete root;
		root = 0;
	}
	return 1;
}
void Init()
{
	m_hash['a'] = 2;
	m_hash['b'] = 2;
	m_hash['c'] = 2;
	m_hash['d'] = 3;
	m_hash['e'] = 3;
	m_hash['f'] = 3;
	m_hash['g'] = 4;
	m_hash['h'] = 4;
	m_hash['i'] = 4;
	m_hash['j'] = 5;
	m_hash['k'] = 5;
	m_hash['l'] = 5;
	m_hash['m'] = 6;
	m_hash['n'] = 6;
	m_hash['o'] = 6;
	m_hash['p'] = 7;
	m_hash['q'] = 7;
	m_hash['r'] = 7;
	m_hash['s'] = 7;
	m_hash['t'] = 8;
	m_hash['u'] = 8;
	m_hash['v'] = 8;
	m_hash['w'] = 9;
	m_hash['x'] = 9;
	m_hash['y'] = 9;
	m_hash['z'] = 9;
}

int main()
{
	int i = 0, n = 0,t,  n1, j, m, k;
	char word1[N];
	char word2[N];
	Init();
	while (scanf("%d", &t) != EOF )
	{
		while(t--)
		{
			scanf("%d %d", &n, &m);
			for (i = 0;i < n; ++i)
			{
				scanf("%s", words[i]);
			}
			root = 0;
			for (i = 0;i < m;++i)
			{
				scanf("%s", word1);
				n1 = strlen(word1);
				for (j = 0; j < n1; ++j)
				{
					word2[j] = m_hash[word1[j]] + '0';
				}
				word2[j] = 0;
				InsertTree(word2);
			}
			for (i = 0;i < n; ++i)
			{
				SearchTree(words[i]);
			}
			DeleteTree(root);
		}
	}
	return 0;
}


Sigrity Power Tree如何进行直流压降仿真分析操作指导 Sigrity Power Tree模式可以用于前仿真,在没有layout文件的情况下对电源进行直流压降仿真分析,用于评估原理图设计以及器件选型是否合理。Model:设置为Equal Current,设置为等电源模型,意思该负载每个电源pin都是等电流的。Current:设置每个负载的电流,U30为3A,U3-U6各为1A。Nominal Current:设置能够承载的最大电流,设置为10A。Upper/ Lower Tol:设置为压降范围为5%Output Current:设置输出电流为10A。 阅读详情

相关推荐

Windows 2008 R2虚拟机跑金蝶K3 WISE 12.1的5个关键配置细节(附避坑清单)

本文详细介绍了在Windows Server 2008 R2虚拟机中部署金蝶K3 WISE 12.1的5个关键配置细节,包括服务器角色与账户权限、组件服务调优、数据库与中间层协同部署、补丁管理策略及性能优化工具。这些实战经验可帮助企业IT团队避免常见陷阱,确保ERP系统稳定运行。

weixin_30847939的博客 317

HDU - 4287 Intelligent IME 字典树

HDU - 4287 Intelligent IME Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit Status Description   We all use cell phone today. And we

qq_18661257的专栏 1584

MFC 利用soap 调用web service

MFC 利用soap 调用web service

congjiaoyan3682的博客 785

HDU 4287 Intelligent IME (字典树 && map)

字典树 map

NeWnIx 669

内网CentOS离线部署LibreOffice:从依赖缺失到服务启动的完整避坑指南

本文详细介绍了在CentOS内网环境中离线部署LibreOffice的完整流程,包括依赖包准备、安装顺序优化及常见报错解决方案。针对金融等封闭网络场景,提供从rpm包选择到服务启动的全套避坑指南,特别解决libXinerama等图形库缺失问题,确保文档转换服务稳定运行。

weixin_33416697的博客 246

linux 内核vxlan收发包流程

1.vxlan口收包处理流程 前面几章详细介绍了vxlan接口的使用,而且已经知道vxlan是 MAC IN UDP中的封装,因此,在解封装之前,一切按照原有流程走,在此复习一下内核收发包流程(驱动层的数据处理这次不再解析,直接从__netif_receive_skb_core开始) #物理网卡处理中断,触发softirq i40e_intr └─napi_schedule_irqoff #i40e softirq把包放到per cpu backlog,触发softirq i40e_napi_p

魏言华的博客 3825

[字典树] HDU 4287 - Intelligent IME

题意: 给定每个数字对应的几个字母,然后rang

Freeway的博客 1072

《YOLO系列模型的多模态项目》配置使用教程(必看内容)

在根目录的文件夹中用于存放的是我已经配置好的一些多模态融合模型,可结合专栏中相应的文章介绍,进一步了解测试其中内容。

Limiiiing的博客 4653

hdu 4287 Intelligent IME 字典树

// hdu 4287 Intelligent IME 字典树 // // 题目大意: // // 智能abc输入法,2,3,4,5,6,7,8,9分别对应不同的字母 // 现在输入n串数字,m串字母串,问n与m对应的串有多少 // // 解题报告: // // 字典树,先将数字插入到字典树中,并赋予val值,最后 // 将字母对应数字,因为字母对应唯一的数字,这样换成数字就 // 可以进行查

TIMELIMITE的专栏 1014

YOLOv12改进前必看 - YAML模型配置文件详细解读(再也不用担心通道数不匹配) 附网络结构图

YOLOv12的模型配置文件在中,里面包含yolov12的以及的不同大小的模型,本文将详细介绍一下YOLOv12模型文件中各参数的含义。

Limiiiing的博客 3275

SAP成本核算的核心逻辑

SAP成本核算采用"计划-归集-分析"闭环管理,以CO模块为核心,集成PP、MM等模块。核算前需配置标准成本控制范围、成本中心等主数据。标准成本通过BOM和工艺路线计算(CK11N),采购和生产过程记录实际成本差异。制造费用通过成本中心归集,作业成本按实际耗用量分配。完工产品按标准成本入库,月末通过KO88结算工单差异,物料分类账(CKMLCP)还原实际成本。整个流程实现FI与CO数据同步,确保账务一致。关键事务码包括CK11N(成本估算)、MIGO(物料移动)、CO11N(报工)等。

金牌架构师 536

Intelligent IME (HDU-4287)(字典树)

  We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some English letters respective...

菜鸡的博客 236

嵌入式工程师成长之路(0)----认识元件

在电子设计与维修中,认识元件是成功的关键!面对琳琅满目的电阻、电容、电感与二极管,样子形式千奇百怪,你是否也曾陷入困难? 本文基于行业权威分类标准,结合十年工程师实战经验,深度解析4大类、30+子类电子元件的核心特性、应用场景与避坑指南,助你从“小白”秒变“电子高手”!

云轩阁 11万+

hdu4287 Intelligent IME(字典树)

We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some English letters respectively,

gyr 327

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

hdu 4287 Intelligent IME (字典树)

题目链接:   hdu 4287 题目大意:   手机打英文,先给出N个数字串表示按键的顺序                   M个单词的词典,询问按下这些数字串分别会出现多少个词典中的单词 解题思路:   把单词转换成按键数字建成树                   最后一个数字结点w值记录次数                   查询的时候根据数字遍历字典树

ンZee的解题报告 1341

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Hdu 4287 Intelligent IME 字典树 Hash

题意:给出n个字符串(数字代表),在给出m个单词,每个单词都有其对应的数字,问对于n中的每一个字符串,求出其在m字符串中出现的次数 第一种方法:比较简单的字典树,对m个字符串建树,然后查询 第二种方法:因为字符串长度不超过6,所以直接使用hash 字典树代码: #include #include #include #include #include #include #incl

SeeYouAlways 1031

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

hdu 4287 Intelligent IME (字典树+dfs)

http://acm.hdu.edu.cn/showproblem.php?pid=4287 Problem Description   We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be spec...

diansitao5461的博客 140

HDU_4287_Intelligent IME(字典树)

题意:手机英文输入法九宫格键盘中,2~9数字各自代表了自己的字母,求给出的几个数字串分别能够打出下列几个英文单词。

一点也不二 1067

HDU 4287 Intelligent IME(字典树)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4287 题意:根据手机的输入法可以知道 2:a,b,c 3:d,e,f 4:g,h,i 5:j,k,l 6:m,n,o 7:p,q,r,s 8:t,u,v 9:w,x,y,z 先给n个串由数字构成,然后m个串由字母构成。 对于每个数字串,判断可以包含几个字母串,并输出。

Where amazing happens 797

HDU -4287 Intelligent IME 字典树数组模拟

 We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some English letters respectivel...

Kuguotao的博客 358

HDU-4287 Intelligent IME (Trie 字典树 入门题)

Trie(字典树)入门题。题意:电话上每个数字都对应一些英文字母。现在有5000个数字串,5000个英文字母串。问每个数字串有多少个匹配的英文字母串。

hmc0411的博客 1394

HDU 4287 Intelligent IME(字典树数组版)

Intelligent IME Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4776Accepted Submission(s): 2227 Problem Description   We a...

weixin_30399055的博客 136

ACM学习历程—HDU 4287 Intelligent IME(字典树 || map)

Description   We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some English ...

weixin_30872157的博客 118

HDU 4287 Intelligent IME (map水题或字典树+DFS)

题目大意:手机键盘中与数字2相对应的字母有a,b,c;3相对应的字母有d,e,f。给出一些数字串如34,和一些小写字母串。求小写字母对应的数字串出现的次数。字符串abc对应的数字串是111,dh对应的数字串是34。则小写字符串中111出现一次,34出现一次。 程序中也用到简单的hash映射。 #include #include #include #include #define LL

哇哈哈的专栏 692
上一篇: 1到n中1的个数
下一篇: 单向链表归并排序
nothing is worse
博客等级 码龄17年 5粉丝 101原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值