上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: #include<bits/stdc++.h> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define rush! ios::sync_with_stdio(false);cin.tie(0); c 阅读全文
posted @ 2021-01-12 15:57 _LH2000 阅读(135) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.ml/contest/1391/problem/D 位运算,绝妙的一个题 #include <iostream> #include <cstring> #include <cstdio> #include <vector> using namespace std 阅读全文
posted @ 2021-01-10 18:45 _LH2000 阅读(86) 评论(0) 推荐(0) 编辑
摘要: int lowbit(int x){ return x & -x; } 上面的代码可以统计x 的二进制中1 的数量; lowbit(x ^ y) 上面的代码则可以统计x和y中不同位的数量 阅读全文
posted @ 2021-01-10 18:38 _LH2000 阅读(87) 评论(0) 推荐(0) 编辑
摘要: C++的 bitset 在 bitset 头文件中,它是一种类似数组的结构,它的每一个元素只能是0或1,每个元素仅用1bit空间。 下面是具体用法 bitset<4> bitset1; //无参构造,长度为4,默认每一位为0 bitset<8> bitset2(12); //长度为8,二进制保存,前 阅读全文
posted @ 2021-01-10 13:44 _LH2000 阅读(103) 评论(0) 推荐(0) 编辑
摘要: int exgcd(int a,int b,int&x,int&y) { if(b==0){ x=1,y=0; return a; } int r=exgcd(b,a%b,y,x); y-=a/b*x; return r; } 阅读全文
posted @ 2021-01-01 21:45 _LH2000 阅读(70) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> #define N 1500 #define inf 999999999 using namespace std; int a[N],bs[N],nx=0,ny=0,k; int linky[N],lx[N],ly[N],slack[N]; int 阅读全文
posted @ 2020-12-17 22:05 _LH2000 阅读(117) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> using namespace std; #define lson 阅读全文
posted @ 2020-12-07 12:58 _LH2000 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 费马小定理 #include<cstdio> #include<cstring> using namespace std; int Quick_Power(int a,int b,int c) { int ans=1; while(b) { if(b&1) ans=(1ll*ans*a)%c; a= 阅读全文
posted @ 2020-10-08 19:54 _LH2000 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #define Max 1000001 int euler[Max]; void Init(){ euler[1]=1; for(int i=2;i<Max;i++) euler[i]=i; for(int i=2;i<Max;i++) if(euler[i]==i) for(int j=i;j<M 阅读全文
posted @ 2020-10-08 19:25 _LH2000 阅读(101) 评论(0) 推荐(0) 编辑
摘要: ll f[N],invf[N]; ll fpow(ll a,ll k){ ll res=1; while(k){ if(k&1) res=(res*a)%mod; k>>=1; a=a*a%mod; //cout<<1<<endl; } return res; } void init(int n){ 阅读全文
posted @ 2020-10-03 23:26 _LH2000 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页