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

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

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

  • virtual function call on the code
    关于调用虚拟函数的代码-virtual function call on the code
    2023-04-25 01:00:03下载
    积分:1
  • project
    已知资金总数为a(万元),工程数n,以及利润值g(i,j)(表示对工程i投资j万元所获得的利润,其中 ,且j只取整数),试用动态规划方法求出如何分配资金才能使获得的利润 最大(资金的分配以万元为单位)。 (The total number of funds are known to a (million), project the number of n, as well as the profits of the value of g (i, j) (expressed j million investment project i receive the profits, of which only take an integer and j), a trial of dynamic programming how to allocate capital to find ways to get the most profitable (the allocation of funds of thousands of units).)
    2010-01-06 22:12:44下载
    积分:1
  • 接收FG飞行数据 GetFDMData
    用于接收FG飞行数据,并且能够实时显示接收数据(Receiving FG flight data)
    2020-06-23 02:20:02下载
    积分:1
  • Debug
    vc++ mfc界面下制作四连杆曲柄机构仿真对话本(vc++ four-bar linkage crank mechanism simulation produced the following dialogue mfc interface)
    2014-04-25 12:37:16下载
    积分:1
  • socket_test
    说明:  UDP编程,socket编程,可供初学者使用,完成socket通信功能(UDP programming, socket programming, for beginners to use, complete socket communication function)
    2020-12-16 19:44:27下载
    积分:1
  • GISsheji
    说明:  ArEengine和C#开发的GIS桌面软件,实现专题图渲染、缓冲区分析、属性查询(ArEengine and C# development of the GIS desktop software, to achieve thematic map rendering, buffer analysis, attribute query)
    2010-04-15 23:09:12下载
    积分:1
  • RAD 10 c++ Builder 做的安卓摄像头扫二维码 Delphi的也放一起了
    RAD 10 c++ Builder 做的安卓摄像头扫二维码 Delphi的也放一起了 用的是ZXing 的下载了直接编译出安卓的APK放安卓里就可以试效果了罗。。^m^
    2022-08-04 02:50:10下载
    积分:1
  • 使用 C# 写的DLT645电能表调试工具
    使用 C# 写的DLT645电能表调试工具。采用C#编程语言,实现电力行业DL645电能表的调试工具,串口通信。
    2022-06-29 12:23:46下载
    积分:1
  • 多边形网格
    这是一个与三角的多边形网格的程序:D
    2022-08-19 10:16:56下载
    积分:1
  • example25_adc_voltage -140923
    说明:  利用DSP28335做得一个A/D采集电压 通过数码管显示的实验 有助于进一步学习开发DSP开发板 转自硬汉开发板 侵权自删(An experiment of A/D acquisition voltage displayed by digital tube using DSP28335 is helpful to further study and develop the infringement self-deletion from the DSP development board to the self-hardened man development board.)
    2020-06-17 22:40:02下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载