随笔分类 - 其他
摘要:long double double 占8字节,long double 占12字节 long double a; scanf("%LF",&a); a=sqrtl(a); printf("%.10LF",a); 常用函数都要在末尾加个 “l”, 如fabsl(a) , sqrtl(a) , cosl
阅读全文
摘要:数位DP https://loj.ac/problems/tag/104 状压DP https://loj.ac/problems/tag/32,33
阅读全文
摘要:debug #define debug(x) cerr << #x << " = " << x << ' ' #define debugl(x) cerr << #x << " = " << x << '\n' 状压dp int test(int x, int y) { return x >> y
阅读全文
摘要:// cin,cout加速(不能和scanf混用,换行要用endl) ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); namespace Fast_IO{ const int MAXL((1 << 18) + 1);int io
阅读全文
摘要:模板 ll mod; const int maxMat=5; struct Mat{ int n,m; ll v[maxMat][maxMat]; Mat(int n,int m):n(n),m(m){ init(); } void init(){ for(int i=1;i<=n;i++) for
阅读全文
摘要:转载自【 长岛冰茶、】 https://www.cnblogs.com/magisk/p/8809922.html C++的 bitset 在 bitset 头文件中,它是一种类似数组的结构,它的每一个元素只能是0或1,每个元素仅用1bit空间。 下面是具体用法 构造函数 bitset常用构造函数有
阅读全文
摘要:Runtime Error 无向图,前向星存边数组要开两倍 memset()时sizeof(int)和sizeof(ll),sizeof(bool)不要弄错 网络流优化二分图时,边的数量不只是二分图里边数x2,而是边数x2+总点数x2
阅读全文
摘要:常用公式/结论 组合数学公式 圆排列 \(\frac{P_{n}^{m}}{m}=\frac{n !}{(n-m) ! \times m},(1 \leq m \leq n)\) n个不同物品中取m个的圆排列 不尽相异元素全排列 如果 \(n\) 个元素里,有 \(p\) 个元素相同,又有 \(q\
阅读全文
摘要:莫队算法 普通莫队(二维) 莫队算法要求询问能离线处理,并且对于两个相邻询问能够快速转移(通常是O(1)、O(log n)) 基础时间复杂度:L移动:\(O(m*block)\),R移动:\(O(n^2/block)\) ,$block=n/sqrt(m)$时整体复杂度最小,为$O(n*sqrt(m
阅读全文
摘要:时间常数优化方法 1.long long改成int,在读入和初始化时速度会变快(有的时候影响不小,在不确定是否会超时的情况下不能盲目用long long) 2.寻址优化,减少数组的访问,多次访问相同数组元素时可以用引用来替代,尽量用临时变量减少数组访问次数。例子:传统递归版线段树用数组存储点的lef
阅读全文
摘要:牛客第一场 (通过)Integration (https://ac.nowcoder.com/acm/contest/881/B) (未补)Euclidean Distance (https://ac.nowcoder.com/acm/contest/881/C) (未补)Parity of Tup
阅读全文

浙公网安备 33010602011771号