摘要:
今天在做题时,需要用到在一个自定义的结构体数组(实际上是vector容器)里面查找特定的值: 即: struct good { int id; int sc; }; vector<vector<good>> goods; 在goods中查找 id == 特定值 的good。 由于习惯使用vector 阅读全文
摘要:
(一)2 的幂 若 n = 2^x且 x 为自然数(即 n 为 2 的幂),则一定满足以下条件: 恒有 n & (n - 1) == 0,这是因为:一定满足 n > 0。 nn 二进制最高位为 1,其余所有位为 0; n - 1n−1 二进制最高位为 0,其余所有位为 1; 因此可以根据 n > 0 阅读全文