© 2025 Ruibin_Ningh
原码反码和补码
2025-09-16
2025-09-16
无标签
随便记一下,因为过于简单直接复制AI生成的 🟢 1. 原码(sign-magnitude) 规则:最高位是符号位,其余位表示数值的绝对值。 最高位 0 → 正数 最高位 1 → 负数
29
|
0
线段树模版
线段树维护区间和 #include<bits/stdc++.h>
using namespace std;
using ll=long long;
vector<ll>tree,lazy;
void init(int n){tree.assign(4*n+5,0);lazy.assign(4*n
20
|
0
最近公共祖先
倍增写法 #include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,LOG=20;
int n,m,fa[N][LOG],dep[N];
vector<int> g[N];
void dfs(int u,int f){
f
13
|
0