子集枚举——状态压缩应用手段之一

function get_subset(bitmask)
    subset = bitmask
    answer = [bitmask]
    while subset != 0
        subset = (subset - 1) & bitmask
        put subset into the answer list
    end while
    return answer
end function
posted @ 2021-02-26 20:16  visualVK  阅读(67)  评论(0编辑  收藏  举报