![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模板
555
-晚风-
这个作者很懒,什么都没留下…
展开
-
树状数组-
功能1.单点更新#区间查找#模板int lowbit(int x){ return x*-x;}int update(int x,int y) //更新#修改的函数{ while(x<=N) //N是元素个数 { //c[i]是树状数组 c[x]+=y; //y是要更新的值 x+=lowbit(x); }}int getsum(int x) //查询函数{ int ans =0; while(x>0) { ans+=c[x]; x-=lo原创 2020-12-01 12:53:23 · 83 阅读 · 0 评论 -
线段树(模板)
单点修改+区间查询#include<iostream>#include<cstring>#include<algorithm>#include<cstdio>using namespace std;const int N = 1e5+10;struct node{ int l,r,sum;}tree[N<<2];void pushup(int k){`在这里插入代码片` tree[k].sum = tree[k<&原创 2021-09-08 23:28:26 · 52 阅读 · 0 评论 -
2021-09-07
#include<iostream>#include<cstring>#include<algorithm>#include<string>using namespace std;const int N = 1e5;int a[N];int b[N];int main(){ int n; cin >> n; int len =0 ; for(int i=1;i<=n;i++) { cin >> a[原创 2021-09-07 22:28:02 · 62 阅读 · 0 评论 -
快速幂(模板)
#include<iostream>#include<cstring>#include<algorithm>using namespace std;int main(){ long long a,b,c,sum=1;//a底数,b指数,c模 cin >> a >> b >> c; while(b>0) { if(b&1) { sum = sum*a%c; } b >>原创 2021-07-16 16:34:58 · 45 阅读 · 0 评论