hdu4267

【智能车学习】电磁循迹中的基本控制算法 今天心血来潮,突然想总结一下电磁车的一些基本算法,也希望可以给新手同学们一点帮助和参考。本篇主要讲述智能车电磁循迹中涉及到的基本算法,包括滤波算法,归一化算法,PID控制等 阅读详情

郁闷死了,做了两天了,

(i-a)%k==0,可以转化为i%k==a%k;ORZ...

#include<algorithm>
#include<cstdio>
#include<string.h>
#include<vector>
using namespace std;
const int N=50010;
int sum[N<<2][55];
int col[N<<2],res[N]; 
#define lson l,mid, rt << 1
#define rson  mid+1,r,rt << 1 | 1
int mod,LL;
int shunxu[11][11];
void PushDown(int rt)
{
  if(col[rt])
    {
      col[rt<<1] += col[rt];
	  col[rt<<1|1] += col[rt];
	  col[rt]=0;
	  for(int i=0;i<55;i++){
	  sum[rt<<1][i] += sum[rt][i];
	  sum[rt<<1|1][i] += sum[rt][i] ;
	   sum[rt][i]=0;
	  }
	 
    }
}
void build(int l,int r,int rt)
{
     col[rt]=0;
	 memset(sum[rt],0,sizeof(sum[rt]));
    if(l==r)
	return;
	int mid=(l+r)>>1;
   build(lson);
     build(rson);
}
void update(int L,int R,int val,int l,int r,int rt)
{
     if(l==L&&r==R)
	 {
	  col[rt]+=val;
	  sum[rt][shunxu[mod][LL%mod]]+=val;
	  return ;
	 }
  PushDown(rt);
   int mid=(l+r)>>1;
  if(R<=mid)update(L,R,val,lson);
    else if(L>mid)update(L,R,val,rson);
   else {
    update(L,mid,val,lson);
     update(mid+1,R,val,rson);
    }
}
int query(int l,int r,int rt,int m)
{
	
   if(l==r)
   {
     int d=0;
	 for(int i=1;i<=10;i++)
		 d += sum[rt][shunxu[i][m%i]];
	 return d+res[l];
   }
   int mid=(l+r)>>1;
   PushDown(rt);
   if(m<=mid)
	   return query(lson,m);
   else return query(rson,m);
}
int main()
{
	int n,q,cc=0;
	for(int i=1;i<=10;i++)
		for(int j=0;j<i;j++)
			shunxu[i][j]=cc++;
	while(~scanf("%d",&n))
	{
	   build(1,n,1);
	   int q;
	  for(int i=1;i<=n;i++)
		  scanf("%d",&res[i]);
	  scanf("%d",&q);

	   int kk,aa,RR,k,val;
	   while(q--)
	   {
	   scanf("%d",&kk);
	   if(kk==2)
	   {
		   scanf("%d",&aa);
	      printf("%d\n",query(1,n,1,aa));
	    } else if(kk==1)
	     {
	      scanf("%d%d%d%d",&LL,&RR,&mod,&val);
		  update(LL,RR,val,1,n,1);
	     }
	   }
	}
 return 0;
}


Vivado与Vscode无缝集成:高效Verilog开发环境搭建指南 本文详细介绍了如何将Vivado与Vscode无缝集成,打造高效的Verilog开发环境。通过替换Vivado默认编辑器为Vscode,配置必备插件和语法检查工具,开发者可以大幅提升FPGA项目的编码效率。文章还提供了代码片段、Testbench自动生成等高级技巧,帮助开发者快速上手这一集成方案。 阅读详情

相关推荐

Vivado里LDPC IP核怎么配?手把手教你从6144bit数据到完整参数设置

本文详细介绍了在Vivado中配置LDPC IP核的完整流程,从6144bit数据的参数计算到实际IP核设置。通过分析基本图选择、扩展因子计算和移位参数确定等关键步骤,帮助工程师高效完成LDPC编译码的硬件实现,并提供了时序控制、仿真验证和性能优化的实用技巧。

weixin_30352645的博客 519

HDU4267(树状数组)

题目大意:给一数列,有两种操作,一种是在[a, b]内,对(i - a) % k == 0 的所有值加上c,另一种是查询某个位置的值。 思路:由于本题k #include #include #include #include #include #include using namespace std; const int maxn = 55555; int aa[maxn]; in

phantom_kiddo的博客 550

华三模拟器实战:IPSec VPN穿越NAT的完整配置与调试(附常见问题排查)

本文详细解析了华三模拟器中IPSec VPN穿越NAT的完整配置与调试方法,包括基础环境准备、分步配置、ACL协调策略及高级故障排查。通过实战案例和关键参数解析,帮助网络工程师解决IPSec与NAT协同工作的典型问题,提升企业网络安全性。

weixin_33724046的博客 461

hdu4267——树状数组

题意:经典的区间更新,单点查询。但是在更新的时候,是更新满足(i - a) % k == 0的点。a为区间左端点。 按同余类建55个树状数组,更新的时候落实的具体某一个树状数组上,查询的时候,按i模1~10所得的值去查询对应的树状数组。 #include #include #include #include using namespace std; const int maxn =

cool_Fires的专栏 729

资产监测设备中130dBm的GPS信号注入天线端口,C/N0一般是多少?

笔者的团队一直从事于资产监测设备的开发,在开发过程中,涉及到很多细节的问题,针对新入职的同事来说较为陌生。同时,在团队外,还有需要对智能硬件终端开发感兴趣的用户。基于此背景下,笔者将在下面的内容主要介绍资产监测设备以及对设备中的GPS相关的问题:130dBm的GPS信号注入天线端口,C/N0一般是多少?作出详细的解答。 资产监测设备概述: 资产监测设备是基于物联网通信技术基础上的智能硬件终端,其主要作用是帮助用户监测资产在仓库、运输途中、交付整个流通环节中,提供资产的实时位置与状态参数。用户只需要登录资产

瑞奇聊通信模组 1229

从ARCore到AICore:揭秘Google如何通过系统级服务推动Android生态创新

本文深入探讨了Google如何通过AICore等系统级服务推动Android生态创新。从ARCore到AICore,Google通过分层解耦策略将AI能力下沉至系统层,实现端侧大模型推理,如Gemini Nano在Pixel 8 Pro中的应用。文章剖析了AICore的技术架构、开发者赋能路径及场景化实践,展示了其在通信、内容创作和生产力工具中的卓越表现。

rust6ferris的博客 545

HDU 4267 (树状数组)

又是树状数组的专题,好多都做过,以为没有什么能够难倒我,然而还是有些题目虽然做出来了但是废了点周折。         这题的话,就是区间修改单点查询,但是不同之处在于,在一个区间内,他不是全部都修改,而是隔几个的修改。例如说,当k=2的时候,对于区间[l,r],修改l、l+2,l+4,……然后k是给定的,满足1 <= k <= 10。

alpc_qleonardo 579

故障处理:Oracle一体机磁盘故障时磁盘组重平衡失败的故障处理

摘要: Oracle Exadata一体机出现磁盘故障案例,存储节点故障灯未亮但磁盘已产生大量坏块,导致重平衡失败。文章强调了一体机硬件巡检需检查6个关键维度:节点messages日志、存储cell告警日志、CellCLI日志、ASM告警日志、ILOM日志及服务器信号灯。故障分析显示硬盘物理故障导致磁盘组冗余受损,自动修复流程受阻。文中详细记录了通过CellCLI工具排查损坏磁盘的过程,并提供了完整的故障处理流程和命令输出。文章同步发布于微信公众号"IT民工的龙马人生"和博客网站(www

提供数据库技术支持(系统优化,故障处理,安装升级,数据恢复等) 1231

【HDU 4267】三维树状数组

1.题目链接。题目的操作其实很像去区间修改,区间查询的操作了,但是这个操作的区间不再是连续的了,而是离散的。但是这里还是可以用树状数组维护的,因为k很小,所以k和i%k其实只有C(10,2)种情况,我们对每一种情况建一颗树状数组,然后查询的时候查对应的树状数组即可。 #include<bits/stdc++.h> using namespace std; #define lowbi...

YG爱木木 361

告别地图偏移!手把手教你用MapOnline V1.2在ArcGIS里加载无偏谷歌影像和历史影像

本文详细介绍了如何使用MapOnline V1.2插件在ArcGIS中加载无偏谷歌影像和历史影像,解决GIS工程师长期面临的地图偏移问题。通过三步安装配置、无偏影像加载和时空分析功能,提升地理信息数据的精确度和工作效率,特别适用于城市规划、环境监测等场景。

weixin_29252171的博客 232

YOLO26改进策略【多YAML融合】| UNetV2 + BiFormer + WIoU

Wise-IoU是一种基于IoU的损失函数,旨在解决目标检测中边界框回归损失函数在处理低质量训练数据时的问题。

Limiiiing的博客 220

HDU4267(线段树 +有规律的多个端点更新)

A Simple Problem with Integers Time Limit: 5000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5765    Accepted Submission(s): 1847 Problem Description

tystrwor的博客 339

超声波传感器(CHx01) 学习笔记 Ⅲ - I2C读写操作

CH-x01 通过 2 线 I2C 协议与主机处理器通信

nicole088的专栏 1740

HDU 4267 A Simple Problem with Integers(12年长春 线段树)

转载请注明出处,谢谢http://blog.youkuaiyun.com/acm_cxlove/article/details/7854526       by---cxlove  题目:给出n个数,每次将一段区间内满足(i-l)%k==0  (r>=i>=l) 的数ai增加c http://acm.hdu.edu.cn/showproblem.php?pid=4267  比较容易往线段树上想的。但

窝不是爱酱,喵~~~~ 5957

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

【hdu4267 A Simple Problem with Integers】 线段树之区间操作

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4267 题目大意:给你一列数区间范围为[1,n],区间每个数有一个对应值a[i]。接下来有Q个操作 操作1:"1 a b k c", 区间[a,b]内满足条件(i-a)%k==0的数值a[i]加c。 操作2:“2 a” ,输出a[i]的值。 解题思路:这题蛋都碎成渣渣了,...

baidui8622的博客 120

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

hdu4267(树状数组,有规则区间修改)

题目链接:点击打开链接 //hdu4267 //题目大意:一段序列,修改某个区间 下标号成等差序列 的元素的值,查询某个点的值 //对每个公差 以及 某段开始下标对每个公差的取余(确定某个点被修改的方式,或者这个修改的起始位置?) 建立k*k个树状数组 #include #include #include #include #include #include #include #

如履薄冰、如临深渊 357

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

hdu 4267 the Ghost Blows Light

欢迎访问我的博客:http://haofly.net/blog/2014/03/26/hdu4267/ 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4276 参考链接:http://blog.youkuaiyun.com/u012841845/article/details/18739425 以及:http://blog.youkuaiyun.com/xianxin

豪翔天下 1282

hdu 4267 A Simple Problem with Integers

http://acm.hdu.edu.cn/showproblem.php?pid=4267   一道加强版的树状数组题,利用题目的关键点——除数较小,可以想到将除数跟余数分类,最多分成55种情况,也就是每个结点存放55个数据的的树状数组。   建树相对简单,遵循思路,直接构建【区间修改,单点查询】的树状数组。就是query的时候比较难想懂,不过明白构树的原理,反过来就可以知道query时要查...

weixin_33754913的博客 84

hdu 4267 A Simple Problem with Integers (线段树)

http://acm.hdu.edu.cn/showproblem.php?pid=4267转自:http://blog.youkuaiyun.com/acm_cxlove/article/details/7854526 题目:给出n个数,每次将一段区间内满足(i-l)%k==0 (r>=i>=l) 的数ai增加c http://acm.hdu.edu.cn/showproblem.p...

weixin_30396699的博客 69

HDU 4267 A Simple Problem with Integers(线段树)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4267 题意:一开始给出n个位置的值,接下来的m个操作: 1. a b k x 表示在 a 到 b 里面满足 (i-a)%k == 0 的位置上的值都加 x 2. 询问a点的值 思路:每次更新的都是满足i%k==a%k的位置,因为k<=10,故而考虑所有的取余情况共有55种,对...

Tongqi 571

HDU 4267 A Simple Problem with Integers

2012长春网络赛1001题比赛时没写出来,一直TLE(标记结构不能拉链表,而要直接开10*10的数组)思路:把数组分成sqrt(n)块,块内暴力更新 块间更新标记复杂度 O(55*n*sqrt(n))代码:#include <iostream>#include <stdio.h>#include <string.h>#include <algorit...

weixin_30784945的博客 86

hdu 4267

http://acm.hdu.edu.cn/showproblem.php?pid=4267 又学到了一点 区间更新 单点查值得树状数组 代码: #include #include #include #include #include #include #include #include using namespace std; int n; int num[50005

talak的专栏 805

HDU 4267

这棵线段树又写跪了! 需要明白(i - a) % k == 0等价与i%k=a%k 单点查询 #include #include #include #include #include #include #include #include #include #define eps 1e-7 #define LL long long #define N 5

1292765944的专栏 810

HDU4267

题意:第一行一个n,表示数的个数,下面一行n个数是初始数值,然后一行一个数m代表m个询问数,1 a b k c代表a到b区间内每隔k个数加c;2 a代表询问a出的值。树状数组可解,如果是对a到b区间内的所有数加c用树状数组很好解决,对于此题,由于是a、b间每隔k个数才进行更新,k的值在10之内,取余数也比较少可以对对应每个k建一棵树,对应的每个余数进行更新,数组定义就变成了C[N][11][11]

今天的风儿好喧嚣~ 671
上一篇: 2012 ACM/ICPC Asia Regional Tianjin Online && hdu4279 Number
下一篇: 月老的难题&&二分图最大匹配模板&&http://acm.nyist.net/JudgeOnline/problem.php?pid=239
Java_beginer1
博客等级 码龄16年 22粉丝 84原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值