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

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

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

  • jiugongwenti
    (九宫问题)在一个3×3的九宫中有1-8这8个数及一个空格随机的摆放在其中的格子里,如图1-1所示。现在要求实现这个问题:将该九宫格调整为如图1-1右图所示的形式。调整的规则是:每次只能将与空格(上、下、或左、右)相邻的一个数字平移到空格中。试编程实现这一问题的求解。((Nine-palace issues) in a 3 × 3 of the Nine-palace are 1-8 this 8 random number and the placing of a space in which the cell house, as shown in Figure 1-1. Now required to achieve this issue: the squares adjustment for the right as shown in Figure 1-1 form. Adjustment of the rules: each can only be with the spaces (upper and lower, or left, right) adjacent to a digital flat space. Test Programming to solve this problem.)
    2008-12-25 22:07:50下载
    积分:1
  • face_detect
    一个关于人脸识别的系统方案,基于linux的,可以下来看看(A program on the face recognition system, based on linux, and can look down)
    2010-05-25 17:56:39下载
    积分:1
  • LC
    说明:  LC滤波电路设计文档 一本非常好的书籍 很清晰易懂(LC DESIGN)
    2013-11-20 12:37:14下载
    积分:1
  • metal-detector
    this metal detector full project (pulse induction)
    2014-01-01 13:26:57下载
    积分:1
  • sunxi-MFC
    经典的孙鑫MFC视频教程及源码,非常适合初学者学习。(The classic Sun Xin MFC video tutorial and source code, very suitable for beginners to learn)
    2013-01-08 11:25:22下载
    积分:1
  • 03
    说明:  03年电赛题目 51单片机实现 包括红外光电传感器 金属传感器 寻光检测 循迹避障等(2003 title game 51 power MCU including infrared photoelectric sensor to find the light sensor detects metal tracking obstacle avoidance, etc.)
    2011-10-14 12:50:27下载
    积分:1
  • jsjdkgl
    计算机系贷款管理(Department of Computer Loan Management)
    2004-11-10 08:57:54下载
    积分:1
  • st_asio_wrapper
    它是一个c/s网络编程框架,基于对boost.asio的包装(最低在boost-1.49.0上调试过),目的是快速的构建一个c/s系统;效率高、跨平台、完全异步,当然这是从boost.asio继承而来; 自动重连,数据透明传输,自动解决分包粘包问题(这一特性表现得与udp一样); 只支持tcp和udp协议;(It is a c/s network programming framework, based on boost.asio package (minimum tried to increase the boost-1.49.0), the purpose is to build a fast c/s systems efficient, cross-platform, fully asynchronous, Of course, this is from boost.asio inherited Auto-reconnect, transparent data transmission, automatic sub-stick package to solve the problem (this feature behave the same with udp) Only supports tcp and udp protocol )
    2013-08-22 10:10:54下载
    积分:1
  • ajtool
    傲劍瑞火輔助程式 品質優良 每天有一小時半的免費使用 不必買正版 也可使用 省下了各位盯著螢幕的時間(Aojian helper quality Swiss fire an hour and a half a day free to use without legal copies you can also use saved the time staring at the screen)
    2013-10-01 22:43:38下载
    积分:1
  • 无线模块
    说明:  基于stm8l151开发的lora模块,批量出货的产品。非常稳定。(Based on the Lora module developed by stm8l151, the products are shipped in batches. Very stable.)
    2020-08-28 17:52:27下载
    积分:1
  • 696516资源总数
  • 106442会员总数
  • 11今日下载