状压DP
状压DP
状压 DP 是动态规划的一种,通过将状态压缩为整数来达到优化转移的目的
枚举状态中的子集
利用x = (x - 1) & s 来不重不漏的找子集
void find_subset(int s){
int x = s;
while(x){
x = (x - 1) & s;
cout << x << '\n';
}
return ;
}
相关资料
例题
本文来自博客园,作者:Qiansui,转载请注明原文链接:https://www.cnblogs.com/Qiansui/p/17726723.html

浙公网安备 33010602011771号