PKU 3468 A Simple Problem with Integers

Matlab双目相机标定 1 概述 现在有许多双目相机在出厂时就已经标定好了,用户拿到手后可以直接使用,例如Intel Realsense系列。但是有些相机出厂的时候并没有完成标定工作,因而这个时候就需要我们自己来标定。由于笔者曾改装过一个双目相机,最远可以测至50m,因此有一定的心得体会想给大家分享一下。本文主要介绍双目相机标定的整个过程,以及导出标定数据的方法。 相机标定主要分为手动标定和自动标定,手动标定比较繁琐,这里主要介绍基于matlab工具箱的自动标定方式来对双目相机进行标定。具体的相关标定细节也可以参照这篇博客:m 阅读详情
题目:http://poj.org/problem?id=3468

题意:有N个整数,有两个操作,一个是对给定的区间增加值,一个是查询给定区间的和

#include <stdio.h>
const int maxn=100000;
struct SegmentTree
{
	int l, r;
	long long sum, lazy;
}st[maxn<<2];
long long z[maxn+10], ans, c;
int n, q, a, b;
char ch[3];
void BuildTree(int v, int left, int right)
{
	st[v].l=left, st[v].r=right, st[v].lazy=0;
	if (left==right)
	{
		st[v].sum=z[left];
		return;
	}
	int lc=v<<1;
	int rc=lc+1;
	int mid=(left+right)>>1;
	BuildTree(lc, left, mid);
	BuildTree(rc, mid+1, right);
	st[v].sum=st[lc].sum+st[rc].sum;
}
void Insert(int left, int right, int v, long long x)
{
	if (st[v].l==left&&st[v].r==right)
	{
		st[v].lazy+=x;
		return;
	}
	int lc=v<<1;
	int rc=lc+1;
	int mid=(st[v].l+st[v].r)>>1;
	st[v].sum+=(x*(right-left+1));
	if (left>mid) Insert(left, right, rc, x);
	else if (right<=mid) Insert(left, right, lc, x);
	else
	{
		Insert(left, mid, lc, x);
		Insert(mid+1, right, rc, x);
	}
}
long long Query(int left, int right, int v)
{
	if (st[v].l==left&&st[v].r==right)
	{
		ans+=st[v].sum+st[v].lazy*(right-left+1);
		return ans;
	}
	int lc=v<<1;
	int rc=lc+1;
	int mid=(st[v].l+st[v].r)>>1;
	st[v].sum+=st[v].lazy*(st[v].r-st[v].l+1);
	st[lc].lazy+=st[v].lazy, st[rc].lazy+=st[v].lazy;
	st[v].lazy=0;
	if (left>mid) Query(left, right, rc);
	else if (right<=mid) Query(left, right, lc);
	else Query(left, mid, lc)+Query(mid+1, right, rc);
}
int main()
{
	//freopen("in.txt", "r", stdin);
	while (scanf("%d %d", &n, &q)==2)
	{
		for (int i=1; i<=n; i++) scanf("%lld", &z[i]);
		BuildTree(1, 1, n);
		for (int i=0; i<q; i++)
		{
			scanf("%s", ch);
			if (ch[0]=='C')
			{
				scanf("%d %d %lld", &a, &b, &c);
				Insert(a, b, 1, c);
			}
			else
			{
				scanf("%d %d", &a, &b);
				ans=0;
				printf("%lld\n", Query(a, b, 1));
			}
		}
	}
	return 0;
}


Python 爬虫项目:爬取百度贴吧帖子,保存标题与评论内容 在 Python 爬虫技术的学习与实战体系中,贴吧类动态内容爬取是典型的入门进阶案例,百度贴吧作为国内主流的社区论坛平台,其页面结构规范、数据载体清晰,非常适合用于巩固爬虫核心技术栈。本次实战项目基于requests请求库与解析库实现完整的爬取流程,从网页请求、数据解析、内容提取到本地持久化存储全链路落地,既能掌握基础爬虫的核心逻辑,也能理解网页结构化数据解析的通用思路,同时规避爬虫常见的反爬基础策略,具备极高的实战参考价值。本文核心价值。 阅读详情

相关推荐

模电专题-MOS管的放大电路分析

在实际应用中,我们经常会使用到功率MOS,这时通常不会将它当成一个开关使用,而是当成一个放大器来使用,那这就需要让其工作在放大状态。参考下图中的mos管的特性曲线,右图中的输出特性曲线中有一根红色的分界线,这个线就是区分mos管工作状态的分界线,在红线的左边,mos管工作在可变电阻区,也就是线性区;在红线的右边mos管工作在恒流区,也就是饱和区。当然,还有一个截止区。本文分析主要运用模电课本中的理论计算验证。

Anitawen的博客 2万+

pku -- 3468 A Simple Problem with Integers(线段树)

题目连接:http://poj.org/problem?id=3468       Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 17698 Accepted: 4581 Case Time Limit: 2000MS Description You have N integers, A1, A2

蓝色污点的专栏 996

用Bus Hound和MIDIOX抓包分析USB MIDI数据流:从硬件接口到软件解析的完整实战

本文详细介绍了如何使用Bus Hound和MIDIOX工具抓包分析USB MIDI数据流,从硬件接口到软件解析的完整实战过程。通过解析MIDI协议、捕获Note On/Off事件、控制变更消息等实例,帮助开发者深入理解音乐数字接口的底层通信机制,并提供了常见问题的解决方案和调试技巧。

weixin_42692935的博客 404

pku3468 A Simple Problem with Integers

http://poj.org/problem?id=3468 线段树,成段更新 注意long long 1 #include <stdio.h> 2 3 #define lson l, m, root<<1 4 #define rson m+1, r, root<<1|1 5 #define N 100100 6 ...

weixin_30570101的博客 119

无人机避障——卡内基梅隆大学(CMU)CERLAB 无人机自主框架复现

CMUCERLAB无人机自主框架是一个模块化的无人机自主导航系统,包含感知、测绘、规划和控制等组件。安装过程中遇到的主要问题包括:(1)cv_bridge路径未正确识别,需手动指定路径;(2)OpenCV版本冲突(4.2与4.6),导致动态导航节点崩溃。解决方案包括:完全卸载OpenCV4.2,重新编译安装OpenCV4.6,并修改相关CMakeLists文件指定版本。最终成功运行仿真环境,实现无人机在Gazebo和RViz中的自主避障导航功能。

weixin_45390670的博客 1644

关于海康网络摄像头使用VLC或者Opencv拉流有延迟的问题

先说结论,我用VLC或者Pyhton opencv直接拉取海康网络摄像头的rtsp流,会有1-2s延时,特别明显。环境:Windows + VLC / Openc-Python。如上面文章介绍,我使用的时候遇到一处错误,需要把代码中的。海康SDK:与网页视频相比,几乎是同步的。上面说的延时,也是与摄像头网页视频相比的。ffplay 去掉缓存:延时1s左右。这两处地方改成左斜杠,才能运行。opencv拉流使用的是。多线程:延时1s左右。

yljxh的博客 4497

3212: Pku3468 A Simple Problem with Integers

题目链接题目大意:线段树区间求和,区间查询题解:我为什么要看这样的题……

蒟蒻的Bzoj记录 452

Moodle平台题库建设技术

Moodle平台题库建设技术简述1新的改变1功能快捷键1合理的创建标题,有助于目录的生成1如何改变文本的样式1插入链接与图片1如何插入一段漂亮的代码片1生成一个适合你的列表1创建一个表格1设定内容居中、居左、居右1SmartyPants1创建一个自定义列表1如何创建一个注脚注释也是必不可少的1KaTeX数学公式1新的甘特图功能,丰富你的文章1UML 图表1FLowchart流程图1导出与导入导出1...

lxf78的博客 4533

pku 3468 A Simple Problem with Integers(线段树)

A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 44296   Accepted: 12961 Case Time Limit: 2000MS Description You have N

街角的花街糖 579

Centos7安装NVIDIA驱动并在docker容器中使用GPU

Centos7安装NVIDIA驱动并在docker容器中使用GPU

运维giao的博客 2084

2025.06.16【转录组】|Ribo-seq数据流程详解(二 基因组比对)

本文详细介绍了Ribo-seq数据分析中的比对流程,包括环境准备、STAR索引构建、比对参数设置及结果统计可视化。通过samtools和R脚本实现比对质量评估,提供常见问题解决方案和关键指标解读。该流程强调比对参数优化和质量控制,为后续翻译组学分析奠定基础。

1976

pku 3468 A Simple Problem with Integers

     本题明显是线段树的题目,刚开始的时候写的时候,更新操作是使用节点更新,结果果断TLE,然后用树状数组做也果断TLE。后面看了别人的做法,发现要添加一个域用来维护增量, 就像hdu1698 Just a Hook需要添加一个域来标记整个区间是否被覆盖了,在查询的时候需要检查增量是否为零,如果不为零则需要把增量往左右子树传递这和hdu1698 Just a Hook的查询有类似的操作,代码如下。/* Author: ACb0y Date: 2010-9-10 Type: segment t

个人独立博客http://www.acb0y.cn/ 977

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

[BZOJ3212]Pku3468 A Simple Problem with Integers

同POJ3468,区间加+区间求和. 我写的是用树状数组维护差分序列实现区间修改的版本.

Zvezda_的博客 471

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

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

13212:Pku3468 A Simple Problem with Integers

【代码】13212:Pku3468 A Simple Problem with Integers。

最近补作业,不更 311

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

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

BZOJ3212 Pku3468 A Simple Problem with Integers 题解

题目大意:   一个数列,有两个操作:1.修改操作,将一段区间内的数加上c;2.查询操作,查询一段区间内的数的和。 思路:   线段树裸题,区间修改、区间查询,维护和以及加上的数,由于无序,不需要向下推标记,只需在子树更新完之后更新根节点即可。 代码: 1 #include<cstdio> 2 #include<cstring> 3 #in...

diyaochang9767的博客 139

BZOJ 3212 Pku3468 A Simple Problem with Integers 线段树

Description   You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other

I'm Growing 355

pku3468: A Simple Problem with Integers

pku3468: http://poj.org/problem?id=3468题意:给定一段区间,其初始数值给定,Q [a,b]表示求区间[a,b]的和,C [a,b]c表示将区间[a,b]的所有数值加上c 解法:线段树lazy思想:由于整段要更新,所以每次只需更新父节点,并用lazy标记,当遇到lazy!=0时,更新下一代,同时标记,这样一直往下更新。code: #include<...

weixin_30522183的博客 94

BZOJ3212 Pku3468 A Simple Problem with Integers

线段树 题目传送门 全裸线段树 代码: #include&lt;cctype&gt; #include&lt;cstdio&gt; #include&lt;cstring&gt; #include&lt;algorithm&gt; #define N 100005 #define F inline using namespace std; typedef long long LL; s...

forezxl的博客 259

[BZOJ3212] Pku3468 A Simple Problem with Integers

传送门http://www.lydsy.com/JudgeOnline/problem.php?id=3212题目大意区间修改,区间查询和题解水题const maxn=100005; type aa=record l,r:longint; val,tag:int64; end; var w:array[0..8*maxn]of aa; i,j,k:longint; n,m:longi

slongle的专栏 447
上一篇: HDU 1698 Just a Hook
下一篇: PKU 2352 Stars
Mei废话
博客等级 码龄14年 5粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值