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

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

于 2022-01-25 发布 文件大小:1.51 kB
0 196
下载积分: 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 个回复

  • stm32单片机循迹程序(源码+原理图+GPIO分配文档)
    【实例简介】stm32f103c8t6循迹小车程序,是一个不错的寻迹避障资料
    2021-05-20 14:39:25下载
    积分:1
  • matlab_rs232
    matlab下利用s-function实现rs232编码、解码及通讯的实例程序。需要在matlab下利用mex编译使用(参见s-function用法)(matlab using s-function to achieve rs232 encoding, decoding and communication procedures of the examples. Need to use matlab using mex compiler (see the use of s-function))
    2009-06-13 23:14:43下载
    积分:1
  • MENGQIAN1
    是用自己名字命名的基于对话框MFC程序,实现的功能主要是VC++实验6里面的思考题。有复选框,有下拉列表,有输出对话框。(With their own name dialog-based MFC program' s main function is to VC++ inside Experiment 6 Questions. There are checkboxes, pull-down list, there is an output dialog.)
    2014-01-02 19:30:35下载
    积分:1
  • 电力系统潮流计算-牛顿拉夫逊法
    以三机九节点系统为例计算电力系统潮流,适合初学者,易于理解
    2021-05-06下载
    积分:1
  • C4.5算法
    说明:  C4.5算法的C++实现,含离散化处理,数据在nominal文件里(c4.5 algorithm with c++)
    2020-04-10 03:26:35下载
    积分:1
  • carworld
    a racing game using c++ and openGL..simple game for the beginner in openGL
    2020-09-07 14:18:05下载
    积分:1
  • sd
    说明:  sd卡初始,由于SD卡使用SPI模式,并且是块读取(512Byte),所以需要单片机提供大于512的可用RAM,以供缓冲使用 这里可以选择STC89c52RD+、STC89C58RD+、STC89C516RD+,后缀RD+表明扩展RAM是1024字节,RC表明扩展RAM256字节(sd card original, because the SD card using SPI mode, and is a block read (512Byte), so they need the microcontroller to provide more than 512 of the available RAM, for buffer used here can choose STC89c52RD+, STC89C58RD+, STC89C516RD+, the suffix RD+ that extended RAM is 1024 bytes, RC that extended RAM256 byte)
    2011-11-15 12:27:58下载
    积分:1
  • timefunction
    时间函数举例,一个猜数游戏,判断一个人反应快慢,是用C编写的(Function of time, for example, a guess the number of games to determine the response speed of a person is prepared to use C)
    2009-04-14 21:30:03下载
    积分:1
  • Shield
    通过蒙特卡洛方法计算物体对粒子的屏蔽效果(to calculate the shielding by the monte carlo method if you have any question , please to connect me)
    2018-12-29 17:50:26下载
    积分:1
  • TSP
    说明:  传感器网络节点充电路径规划调度算法实现c/c++版本源代码(The realization of the scheduling algorithm for charging path planning of sensor network nodes)
    2021-01-19 20:17:31下载
    积分:1
  • 696516资源总数
  • 106668会员总数
  • 21今日下载