原码反码和补码
随便记一下,因为过于简单直接复制AI生成的 🟢 1. 原码(sign-magnitude) 规则:最高位是符号位,其余位表示数值的绝对值。 最高位 0 → 正数 最高位 1 → 负数
数学中的逻辑运算符
位运算
线段树模版
线段树维护区间和 #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
最近公共祖先
倍增写法 #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
快读快写模版
整型 实用版本 比较适合比赛离线环境,虽然也不太好记 template<typename type> inline void read(type &x){ x=0;bool flag(0);char ch=getchar(); while(!isdigit(ch)) flag=ch=