📜  位掩码动态编程 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:50.557000             🧑  作者: Mango

代码示例1
solve(set, set_size, val)
    count = 0
    for x = 0 to power(2, set_size)
        sum = 0
        for k = 0 to set_size        
            if kth bit is set in x
                sum = sum + set[k]
        if sum >= val
             count = count + 1
    return count