哈夫曼树一共产生个节点
递归的时间复杂度大概率为
优先队列(大根堆)
哈夫曼编码是无损压缩编码且压缩率为%~%
priority_queue<int>q;格雷码奇数时最低位取反,偶数时最后一为的1的前一位取反
格雷码公式
构造函数不可以声明虚函数
s.substr(pos)是从pos开始删除到末尾
s.erase(pos)同理fabs()浮点绝对值
unique函数会将重复的元素移到数组的尾部,并返回一个指针指向新的数组的尾部。使用unique函数时往往要进行sort排序
//对数组a初始化为x
fill(a,a+n,x)
//对vector初始化为x
fill(a.begin(),a.end(),x)常数
线性单层循环 线性筛
二分,*2,/2,gcd
sort,快速排序
递归
埃筛:
字符串的时间复杂度:看长度
基插冒归它很稳,插冒归喜欢选冒插,插完就方了,希快归堆N老了
cstdio 不能用cin,cout
define 不需要;结束
int n;
cin>>n;//枚举所有的因子15 1 3 5 15
for(int i=1;i*i<=n;i++){
if(n%i==0){
cout<<i<<" ";
if(i*i!=n){
cout<<n/i<<endl;
}
}
}
int gcd(int x,int y){
if(y==0)return x;
return gcd(y,x%y);
}
先加分母mod分母
int n;//分解质因子
cin>>n;
for(int i=2;i*i<=n;i++){
while(n%i==0){
cout<<i<<endl;
n/=i;
}
if(n>1)cout<n<<endl;
}void fun(int n,int p){
if(n==1)return ;
if(n%p==0){
cout<<p;
fun(n/p,p);
}else{
fun(n,p+1);
}
} 主页藏起来了,别找了
https://tj.woxy.top/ 写题解专用
https://planet.mblock.cc/project/2670986 2D我的世界
https://icodeshequ.youdao.com/work/5a4ecc7dfd65465ba57af126bf4b51c0?from=rank 三角洲
https://wenxin.baidu.com/new-chat
https://www.luogu.me/paste/nr38brib
https://joshuaurora.github.io/CCF/DZD_Simulator.html
https://qoj.ac/files/OItrainer-main/start.html