3929专题

HDU 3929 Big Coefficients(容斥+证明)

(1 + x)^n 的奇数项系数个数等于 2^(bitcount(n)),bitcount(x)为x有多少个1. 然后容斥 枚举每一项存在不存在,然后容斥加加减减即可 这题用二进制枚举会T,只能DFS 代码: #include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int