HDU 4287 Intelligent IME hash

DiffusionDrive实战:如何用截断扩散模型3个月搞定自动驾驶轨迹规划(附代码) 本文详细介绍了如何利用DiffusionDrive截断扩散模型,在三个月内快速构建端到端的自动驾驶轨迹预测系统。内容涵盖从环境搭建、数据处理、模型架构解析到训练调参和推理优化的完整实战流程,并提供了关键代码示例,旨在帮助开发者高效实现高质量的自动驾驶轨迹规划。 阅读详情

Intelligent IME

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4287

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 letters respectively, as shown below:
  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
  When we want to input the word “wing”, we press the button 9, 4, 6, 4, then the input method will choose from an embedded dictionary, all words matching the input number sequence, such as “wing”, “whoi”, “zhog”. Here comes our question, given a dictionary, how many words in it match some input number sequences?

Input

First is an integer T, indicating the number of test cases. Then T block follows, each of which is formatted like this:
  Two integer N (1 <= N <= 5000), M (1 <= M <= 5000), indicating the number of input number sequences and the number of words in the dictionary, respectively. Then comes N lines, each line contains a number sequence, consisting of no more than 6 digits. Then comes M lines, each line contains a letter string, consisting of no more than 6 lower letters. It is guaranteed that there are neither duplicated number sequences nor duplicated words.

Output

For each input block, output N integers, indicating how many words in the dictionary match the corresponding number sequence, each integer per line.

Sample Input

1
3 5
46
64448
74
go
in
night
might
gn

Sample Output

3
2
0

题意:给定N个包含数字的字符串和M个包含字母的字符串,每个数字对应一些字母,问N个字符串每个代表了多少个含字母的 字符串。

题解:用map预处理数字和字母对应的关系,然后将每个字母的字符串转换后存在map中即可。

AC代码:

/*
* @Author: 王文宇
* @Date:   2018-06-26 02:10:52
* @Last Modified by:   王文宇
* @Last Modified time: 2018-06-26 02:43:02
*/
#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=a;i<=b;i++)
const int maxn = 5005;
int t,n,m;
string s[maxn];
map<int,int> H;
map<string,int> Q;
void intc()
{
	int k = 2;
	_for(i,0,25)
	{
		if(i==3||i==6||i==9||i==12||i==15||i==19||i==22||i==26)
		{
			k++;
		}
		H[i]=k;
	}
}
int main(int argc, char const *argv[])
{
	intc();
	cin>>t;
	while(t--)
	{
		Q.clear();
		cin>>n>>m;
		_for(i,1,n)cin>>s[i];
		string s2;
		_for(i,1,m)
		{
			cin>>s2;
			int l = s2.size()-1;
			_for(i,0,l)s2[i]=H[s2[i]-'a']+'0';
			Q[s2]++;
		}
		_for(i,1,n)cout<<Q[s[i]]<<endl;
	}
	return 0;
}

【小白深度教程 1.32】手把手教你从多视角图像进行 3D 重建(SfM 算法) 重建的目标是从一组照片中推导场景的几何结构,假设摄像机位置和内部参数是已知的或可以从图像集中猜测。 这是通过使用多个照片,在其中应用运动结构法(Structure from Motion,SfM)来解决像素级对应问题,部分地恢复3D信息来实现的。 阅读详情

相关推荐

使用CubeMX生成的项目在Keil下添加DSP库并包含arm_math头文件后报错的解决办法

问题描述: 最近使用Cube生成工程后,在Keil中使用Manage Runtime Environment即绿色小饼干按钮添加CMSIS的DSP库后编译报错。很有意思的是,STM32论坛上有外国朋友报告的同样的错误,都是30个Errors,5个Warning。 问题分析: 参考国内论坛某帖子(具体想不起来了),认为因该是Cube复制了库后,Keil从原始Packs目录下引用DSP库导致和Cub...

qq_32256951的博客 7001

2020-11-22

misc3 20 了解一下 隐藏文字 【目的】  了解隐藏字 【环境】 Windows 【工具】 World 【步骤】 在World中打开,点击文件,找到选项点击,点击显示,勾选隐藏字,点击确定,回到world, 选中空白更换字体颜色 ...

qq_52729430的博客 232

FANUC机器人PROFINET通讯方式组态

6 然后对模块进行命名及更改IP地址,点击“Network Detection”,进行扫描,会生成下图,双击商科模块会生成下边的对话框,对模块进行命名及更改IP地址,在“Permanent Name”处点对勾,完成后点击“Apply Name及Apply”进行命名。此处注意,上图左上在线在不了,网络扫描处上面也灰色的,扫描不了。5双击abcc-prt-2-port RT(FW1.13),生成下面图标,在右边点击1、2把原来内容删掉,从新在左侧加载 ,使1、2是输出,3、4为输入,完成后点击OK。

dxs93的博客 8431

c++标椎库:文本处理

字符串 对于 C++ 里的字符串类 string,string 其实并不是一个“真正的类型”,而是模板类 basic_string 的特化形式,是一个 typedef: using string = std::basic_string<char>; // string其实是一个类型别名 所谓的字符串,就是字符的序列。字符是人类语言、文字的计算机表示,而人类语言、文字又有很多种,相应的编码方式也有很多种。 所以,C++ 就为字符串设计出了模板类 basic_string,再用模板来搭配

LYR1994的博客 865

【寄存器模型】一、一个简单的寄存器模型

在描述寄存器模型之前,首先来了解一下实际寄存器的组成结构:如下图所示的DUT内部真实的寄存器寄存器中最小的一个单位是域(field),域是由一个或多个bit拼接而成的。一个或多个域就构成了一个寄存器(reg)。一个或多个寄存器就构成了一个块(block)。将DUT中的寄存器抽象出来,建立寄存器模型,如下图所示:uvm library已经定义好了field、reg、block等相关的概念,构建寄存器模型时,只需要继承这些类即可。:构建寄存器模型中的域段。uvm_reg。...

carrotbanana的博客 5368

使用RustDesk或者AnyDesk的TCP隧道实现Codesys系列PLC的远程调试和下载

Codesys远程调试

exat500g的博客 7276

C#题目及答案(1)

1. 简述 private、 protected、 public、 internal 修饰符的访问权限。 答 . private : 私有成员, 在类的内部才可以访问。 protected : 保护成员,该类内部和继承类中可以访问。 public : 公共成员,完全公开,没有访问限制。 internal: 在同一命名空间内可以访问。 2 .列举ASP....

weixin_30653023的博客 6506

Ansys-结构动力学分析-圆柱斜齿轮模态分析学习心得

模态分析的步骤基本一直,不同点在于选择什么单元类型,模型,节点约束等 圆柱斜齿轮模态分析的难点在于圆柱斜齿轮的模型建立,和所要约束的节点的选择。 用命令流方法建立齿轮模型效率较高,当然,在ansys里建立复杂的模型实在不敢恭维,对于自下而上建模,需要知道每个关键点的坐标位置。下图是创建圆柱斜齿轮模型的命令流方式。 模型不同使用的数据也就不同了。 对于施加约束的问题这就必须要熟悉select e...

weixin_45385183的博客 1831

vi/vim 删除:一行, 一个字符, 单词, 每行第一个字符 命令

http://dsec.pku.edu.cn/~jinlong/vi/Vi.html x 删除当前光标下的字符 dw 删除光标之后的单词剩余部分。 d$ 删除光标之后的该行剩余部分。 dd 删除当前行。 c 功能和d相同,区别在于完成删除操作后进入INSERT MODE cc 也是删除当前行,然后进入INSERT MO

lcj_cjfykx的专栏 6万+

【WLAN】【基础知识】WIFI那些事儿之信道和频谱(涵盖2.4G、5G、6G,全网最全)

- 从事WIFI相关开发或测试工作,经常要和信道、频宽、频率等打交道,本文仅将平时涉及的2.4G、5G、6G的信道、频宽、频率等做一总结。 - 一图胜万言,本文汇总了工作中经常用到的频谱图,保证全网最全!!! - 本博客地址,https://blog.youkuaiyun.com/qxhgd,欢迎各位关注,转发请注明出处。

一介草民,只为生活。 1万+

Android SystemUI——自定义状态栏和导航栏(十二)

通过前面的文章内容,我们了解了Android系统原生的状态栏StatusBar和车载系统状态栏CarStatusBar的启动流程以及视图构建流程,这里我们来简单的看一下自定义状态栏和导航栏视图的实现流程。

小旭的专栏 2012

操作系统选择题题库

<br />操作系统选择题题库<br />1.以下有关操作系统的叙述中,哪一个是不正确的? (D)<br />A.操作系统管理系统中的各种资源 B.操作系统为用户提供的良好的界面<br />C.操作系统就是资源的管理者和仲裁者 D.操作系统是计算机系统中的一个应<br />用软件<br />2.操作系统所占用的系统资源和所需的处理器时间称为 (D)<br />A.资源利用率 B.系统性能 C.系统吞吐率 D.系统开销<br />3.操作系统所管理的资源包括:ⅠCPU Ⅱ 程序 Ⅲ 数据 Ⅳ 外部设备 (D)

stone的专栏 4万+

微信公众号 - 解决报错 “err_msg“:“system:access_denied“,微信环境浏览器真机使用微信支付、微信授权登录、分享朋友圈转发好友报错system:access_denied

微信公众号,微信网页,手机h5网页,微信报错,system:access_denied,微信支付,提示报错,微信登录授权报错,微信朋友圈分享,微信转发,WeixinJSBridge,微信环境下,微信内置浏览器,微信公众号项目报错system:access_denied,如何解决,invoke(),API调用后出现报错,微信内部H5 WeixinJSBridge.invoke system:access_denied,使用微信jssdk时报access_denied错误,还是报错,真机运行,真机调试api返回

🏆 前端领域优质创作者 1万+

HDU 4287 Intelligent IME(哈希)

原题:http://acm.hdu.edu.cn/showproblem.php?pid=4287

风尘_浪子 861

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

深度学习工具包 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(哈希)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4287 #include #include #include int hash[1000005]; int a[5005]; char str[10]; int judge(char c) { if('a'<=c&&c<='c') return 2; else if('

764

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

字符串哈希- Intelligent IME - HDU - 4287

字符串哈希- Intelligent IME - HDU - 4287 题意: 将26个字母用8个数字代替,规则如下:将26个字母用8个数字代替,规则如下:将26个字母用8个数字代替,规则如下: 2:a,b,c2 : a, b, c2:a,b,c 3:d,e,f3 : d, e, f3:d,e,f 4:g,h,i4 : g, h, i4:g,h,i 5:j,k,l5 : j, k, l5:j,k,...

njuptACMcxk的博客 494

hdu 4287Intelligent IME(简单hash)

Intelligent IME Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1810Accepted Submission(s): 897 Problem Description ...

weixin_30640769的博客 132

Hdu 4287 Intelligent IME 字典树 Hash

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

SeeYouAlways 1031

HDU 4287-Intelligent IME(哈希)

Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2479    Accepted Submission(s): 1212 Problem Description   We all u

Orz~~Orz 1097

hdu4287 Intelligent IME--哈希表

原题链接: 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 cel

半壶老酒 764

HDU-4287-Intelligent IME

HDU-4287-Intelligent IME http://acm.hdu.edu.cn/showproblem.php?pid=4287 开始用字典树+深搜,超时。。。。后来发现题目最多6位数,可将字符串转化成对应的数字,然后hash即可 TLE的代码 #include #include #include #include using namespace std;

菜鸟的程序人生 2522

【STL】 hdu4287 Intelligent IME

Intelligent IME 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4287 题意:对应于手机九宫格按键,给你n个数字串和m个字母串,问对于每个数字串,在m个字母串中有几个字母串是由这个按这个数字串的按键生成的。 题解:把字母哈希到手机数字按键上,对于每个字母串转化为对应的数字串,再通过map查找之前是否有这个字母串,最后计数输出。 代

Ted's 游乐园 2685

HDU 4287 Intelligent IME (map)

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

深海沧澜的博客 335
上一篇: UVAlive 6959 Judging hash
下一篇: Codeforces Round #494 (Div. 3) (ABCDE) 题解
sortmin
博客等级 码龄9年 45粉丝 178原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值