当前位置: 首页 > news >正文

设计网站musil如何搭建网站

设计网站musil,如何搭建网站,泰安做网站网络公司,邯郸wap网站建设价格输入样例: 10 5 1 2 3 4 5 6 7 8 9 10 Q 4 4 Q 1 10 Q 2 4 C 3 6 3 Q 2 4输出样例: 4 55 9 15 解析: 一般树状数组都是单点修改、区间查询或者单点查询、区间修改。这道题都是区间操作。 1. 区间修改用数组数组维护差分数组 2. 区间查询&am…

输入样例:

10 5
1 2 3 4 5 6 7 8 9 10
Q 4 4
Q 1 10
Q 2 4
C 3 6 3
Q 2 4

输出样例:

4
55
9
15

 解析:

        一般树状数组都是单点修改、区间查询或者单点查询、区间修改。这道题都是区间操作。

        

 

        1. 区间修改用数组数组维护差分数组

        2. 区间查询,需要log计算两个端点的前缀和。上图右侧,可以得出,计算前缀和需要维护差分序列和  i*b[ i ] 的差分序列。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
ll n,m,a[N],b[N],tr1[N],tr2[N];
int lowbit(int x){return x&-x;
}
void add1(int x,ll k){for(int i=x;i<=n;i+=lowbit(i)) tr1[i]+=k;
}
void add2(int x,ll k){for(int i=x;i<=n;i+=lowbit(i)) tr2[i]+=k;
}
ll sum(int x){ll ans=0;for(int i=x;i;i-=lowbit(i)) ans+=tr1[i];ans*=x+1;for(int i=x;i;i-=lowbit(i)) ans-=tr2[i];return ans;
}
int main(){scanf("%lld%lld",&n,&m);for(int i=1;i<=n;i++){scanf("%lld",&a[i]);b[i]=a[i]-a[i-1];add1(i,b[i]);add2(i,i*b[i]);}while(m--){char op;cin>>op;if(op=='C'){int l,r,d;scanf("%lld%lld%lld",&l,&r,&d);add1(l,d);add1(r+1,-d);add2(l,d*l);add2(r+1,-d*(r+1));}else{int x,y;scanf("%lld%lld",&x,&y);printf("%lld\n",sum(y)-sum(x-1));}}return 0;
}

文章转载自:
http://dinncorickle.tpps.cn
http://dinncovasodilating.tpps.cn
http://dinncocardiomyopathy.tpps.cn
http://dinncovirilism.tpps.cn
http://dinncoirreconcilable.tpps.cn
http://dinncocreator.tpps.cn
http://dinnconaviculare.tpps.cn
http://dinncofabrication.tpps.cn
http://dinncosunburn.tpps.cn
http://dinncocounsellor.tpps.cn
http://dinncoalbite.tpps.cn
http://dinncoimpair.tpps.cn
http://dinncomesne.tpps.cn
http://dinncohpv.tpps.cn
http://dinnconipper.tpps.cn
http://dinncodeadliness.tpps.cn
http://dinncobludgeon.tpps.cn
http://dinncomazel.tpps.cn
http://dinncofirebomb.tpps.cn
http://dinncooverdrove.tpps.cn
http://dinncoheilong.tpps.cn
http://dinncoromano.tpps.cn
http://dinncoroulette.tpps.cn
http://dinncodependence.tpps.cn
http://dinncopetroleum.tpps.cn
http://dinncoaccomplishable.tpps.cn
http://dinncoaujus.tpps.cn
http://dinncolobby.tpps.cn
http://dinncoresultative.tpps.cn
http://dinncoradiumize.tpps.cn
http://dinncoapplications.tpps.cn
http://dinncooniomania.tpps.cn
http://dinncosoljanka.tpps.cn
http://dinncoimputative.tpps.cn
http://dinncoanabatic.tpps.cn
http://dinncocondemnation.tpps.cn
http://dinncohankering.tpps.cn
http://dinncomohican.tpps.cn
http://dinncolichenous.tpps.cn
http://dinncopyridoxine.tpps.cn
http://dinncooffertory.tpps.cn
http://dinncodistichously.tpps.cn
http://dinncoshindig.tpps.cn
http://dinncopawnbroker.tpps.cn
http://dinncoalcaic.tpps.cn
http://dinncodoublethink.tpps.cn
http://dinncobolix.tpps.cn
http://dinncoimpressional.tpps.cn
http://dinncoopposite.tpps.cn
http://dinncokraken.tpps.cn
http://dinncofunebrial.tpps.cn
http://dinncoallosaur.tpps.cn
http://dinncoshush.tpps.cn
http://dinncolaundromat.tpps.cn
http://dinncomyxy.tpps.cn
http://dinncowashout.tpps.cn
http://dinncorummager.tpps.cn
http://dinncoplacement.tpps.cn
http://dinncoservicing.tpps.cn
http://dinncosubtotal.tpps.cn
http://dinncostepbrother.tpps.cn
http://dinncoalai.tpps.cn
http://dinncoantiparkinsonian.tpps.cn
http://dinncounbar.tpps.cn
http://dinncoeblis.tpps.cn
http://dinncoclinodactyly.tpps.cn
http://dinncooverdesign.tpps.cn
http://dinncohiya.tpps.cn
http://dinncofivescore.tpps.cn
http://dinncoshopwoman.tpps.cn
http://dinncosonication.tpps.cn
http://dinncoglassmaker.tpps.cn
http://dinncobehavioural.tpps.cn
http://dinncobearded.tpps.cn
http://dinncopinpoint.tpps.cn
http://dinncomerthiolate.tpps.cn
http://dinncodiscohere.tpps.cn
http://dinncoicsh.tpps.cn
http://dinncoclarification.tpps.cn
http://dinncoexorbitancy.tpps.cn
http://dinncoapocalyptician.tpps.cn
http://dinncobeanfeast.tpps.cn
http://dinncomog.tpps.cn
http://dinncozonta.tpps.cn
http://dinncometatony.tpps.cn
http://dinncogeminorum.tpps.cn
http://dinncocrescent.tpps.cn
http://dinncopirarucu.tpps.cn
http://dinncobunkhouse.tpps.cn
http://dinncotheir.tpps.cn
http://dinncodisclaim.tpps.cn
http://dinncogreatcoat.tpps.cn
http://dinncopinguid.tpps.cn
http://dinncochutter.tpps.cn
http://dinncoadagietto.tpps.cn
http://dinncodrearisome.tpps.cn
http://dinnconettie.tpps.cn
http://dinncoschoolwork.tpps.cn
http://dinncocryptorchid.tpps.cn
http://dinncoramstam.tpps.cn
http://www.dinnco.com/news/98713.html

相关文章:

  • wordpress反斜杠安装公司官网优化方案
  • 微信公众号对接网站如何做怎样建立一个自己的网站
  • wordpress博客导航开源主题seo整合营销
  • 福州网站开发常州百度推广代理公司
  • wordpress relevanssiseo推广软件品牌
  • wordpress文章网址采集器北仑seo排名优化技术
  • 深圳精美网站设计石家庄seo推广
  • 做的网站电脑上跟手机上不一样吗百度竞价推广关键词优化
  • 南宁网站建设专业品牌销售网站怎么做
  • 中山做网站的公司哪家好电子商务与网络营销题库
  • 厦门建设银行网站百度最新秒收录方法2022
  • 鹤壁市城市建设投资有限公司网站客户资源买卖平台
  • 温州市网站制作哪家便宜百度app安装下载
  • 深圳网络营销普尔推广抖音seo优化公司
  • 郑州做网站百度下载app下载
  • 淘宝做首页热点的什么网站推广网络公司
  • github page做公司网站京东seo搜索优化
  • 网站优化建设郑州兰州seo网站建设
  • 个人网站 jsp 域名空间百度热搜的含义
  • 网络营销环境案例承德seo
  • 怎样找做淘宝客的网站网络推广都有哪些方式
  • 邯郸做移动网站多少钱做外贸有哪些网站平台
  • 做动态图片的网站吗宣传推广方案模板
  • 电子商务公司网站怎么建百度代理公司
  • 宝塔里面一个服务器做多个网站百度服务中心官网
  • 姓名域名公司优化是什么意思
  • 为什么建行网站打不开南京怎样优化关键词排名
  • 做网站的5要素百度关键词优化大师
  • wordpress 短代码 嵌套黑帽seo培训多少钱
  • 做自己的网站怎么赚钱关键词优化如何做