登录
首页 » c++ » 基于线段树的同时快速维护区间乘法和区间加法

基于线段树的同时快速维护区间乘法和区间加法

于 2022-01-25 发布 文件大小:1.51 kB
0 111
下载积分: 2 下载次数: 1

代码说明:

主要就是要注意同时维护加法和乘法的lazytag时,加法和乘法的顺序会影响结果,如: x*2+3 != (x+3)*2 因此 维护其中一个tag时 要同时改变另一个tag 以免去顺序的影响。 因此有两种选择 先维护乘法 和 先维护加法 假设 x节点此时乘法tag是2 加法tag是3,之后获得了乘法tag4 以及加法tag5 先维护乘法: x=(x*2)+3 获得后:乘法tag*4 加法tag*4+5    x=(x*8)+3*4+5 先维护加法: x=(x+1.5)*2 显然涉及小数 有精度问题 不继续了 在确定先维护乘法后 就可以开始线段树了...

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • evaluate.rar
    影像融合评价程序,计算标准偏差,平均梯度,相关系数,光谱扭曲度等融合指标。(Image fusion evaluation, calculation of standard deviation, average gradient, correlation coefficient, spectral distortions, such as integration targets.)
    2009-03-03 20:35:24下载
    积分:1
  • ANN_1.1.2(Newest-Vision-2010-1-27)-
    ANN是一个构造数据索引结果的程序,可以实现最近邻、KD树等功能。ANN is designed for data sets that are small enough that the search structure can be stored in main memory (in contrast to approaches from databases that assume that the data resides in secondary storage). Points are assumed to be represented as coordinate vectors of reals (or integers). The distance between two points can be defi ned in many ways. ANN assumes that distances are measured using any class of distance functions called Minkowski metrics. These include the well known Euclidean distance, Manhattan distance, and max distance.(One diffi culty with exact nearest neighbor searching is that for virtually all methods other than brute-force search, the running time or space grows exponentially as a function of dimension. Consequently these methods are often not signifi cantly better than brute-force search, except in fairly small dimensions. )
    2012-05-31 10:11:29下载
    积分:1
  • NOKIA_LCD5110_STM32
    基于stm32f103的5110显示屏驱动(5110 display driver based on STM32F103)
    2017-07-15 11:07:19下载
    积分:1
  • HP203B
    说明:  真正的气压传感器HP203B的驱动程序,其他都是骗人的,自己看(Real pressure sensor HP203B driver, the rest are deceptive, see for yourself)
    2021-02-15 18:49:47下载
    积分:1
  • OPC服务
    说明:  自动化领域上位机通过OPC服务读取三菱Q系列PLC的方法(How to read Mitsubishi Q series PLC through OPC service)
    2020-05-07 08:47:29下载
    积分:1
  • xiyuxiuxianguanlixitong
    说明:  一个洗浴休闲管理系统代码,MFC开发的,用SQL server数据库(A management system)
    2009-08-23 14:14:54下载
    积分:1
  • stl-huffman
    implement huffman algorithm with stl priority-queue, first you must have the file, then the result is saved(implement Huffman algorithm with stl prio rity- queue, first you must have the file, then the result is saved)
    2007-01-16 15:56:56下载
    积分:1
  • COM
    串口调试助手源码,学习串口编程很不错,也可以编译成串口助手直接用(Serial debugging aids source, learning serial programming is very good, but also can be compiled directly into the serial assistant)
    2021-04-19 09:48:51下载
    积分:1
  • 最简单的目标跟踪(模板匹配)
    使用opencv即可实现跟踪,非常简单,爱上大声大声发生的vsdfsdsdfs啊飒飒的啊实打实asdAsdf水电费算法
    2023-03-03 07:15:04下载
    积分:1
  • TheExam
    局域网考试系统 VC++ 在线考试系统 Access SQL Server VC++在线考试系统可连接Access 或SQL Server(LAN VC++ Online Test System Test System Access SQL Server VC++ online examination system can be connected to Access or SQL Server)
    2011-05-16 10:32:25下载
    积分:1
  • 696518资源总数
  • 105562会员总数
  • 1今日下载