随笔分类 - 算法随笔
摘要:[C++ priority_queue的自定义比较方式] #include<queue> #include<vector> #include<iostream> using namespace std; struct node { int x, y; node(int x, int y) :x(x)
阅读全文
摘要:lowbit 在计算数字二进制表示中有多少个1的时候,可以使用lowbit来表示。每次找到数的最后一个1的大小。 x&(-x) 具体代码为 int num1count(int x) { int m = 0; for (; x; x -= x & (-x)) { m++; } return m; }
阅读全文

浙公网安备 33010602011771号