跳到正文

个人记录

常用代码

Niko_s约 2 分钟
原文
文章信息与版本

文章信息

发布
2026年11月11日
收录
2026年11月25日
更新
2026年11月25日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#define ri register int
#define pii pair<int,int>
#define fir first
#define sec second

using namespace std;

inline int read(){//快读
	int x = 0;
	int f = 1;
	char c = getchar();
	while(c > '9' || c < '0'){
		if(c == '-')f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9'){
		x = (x << 3) + (x << 1) + c - 48;
		c = getchar();
	}
	return x * f;
}

void out(int x){//快写
	if(x < 0){
		putchar('-');
		x = -x;
	}
	if(x > 9)out(x/10);
	putchar(x % 10 + 48);
}

signed main(){
#ifndef ONLINE_JUDGE
	freopen("text.txt","r",stdin);
#endif
    return 0;
}

struct Tree{//树状数组
    int val[SIZN];
    int len;

    inline int LOW_BIT(int x){
        return x & (-x);
    }
    inline void ADD(int x,int k){
        for(int i = x ; i <= len ; i += LOW_BIT(i))val[i] += k;
    }
    inline int QUETY(int x){
        int ans = 0;
        for(int i = x ; i ; i -= LOW_BIT(i))ans += val[i];
        return ans;
    }
}
原文