\(\text{Code}\)
for(int S = 0; S < (1 << n); S++)
for(int T = S; T; T = (T - 1) & S)
//do something
\(\text{Explanation}\)
\(T\) 为 \(S\) 的子集,且枚举子集的复杂度是 \(O(3^n)\)
标签:Code,二进制,text,Explanation,int,枚举,子集
来源: https://www.cnblogs.com/leiyuanze/p/14976267.html