( ext{Code})
for(int S = 0; S < (1 << n); S++)
for(int T = S; T; T = (T - 1) & S)
//do something
( ext{Explanation})
(T) 为 (S) 的子集,且枚举子集的复杂度是 (O(3^n))
for(int S = 0; S < (1 << n); S++)
for(int T = S; T; T = (T - 1) & S)
//do something
(T) 为 (S) 的子集,且枚举子集的复杂度是 (O(3^n))