bitset实现位压加法

Posted tak-fate

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bitset实现位压加法相关的知识,希望对你有一定的参考价值。

 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<algorithm>
 4 using namespace std;
 5 typedef bitset<10000> bint;
 6 inline bint plus(bint a,bint b){
 7     return b.any()?plus(a^b,(a&b)<<1):a;
 8 }
 9 inline bint mul(bint a,bint b){
10     return b.any()?(b[0]?plus(a,mul(a<<1,b>>1)):mul(a<<1,b>>1)):0;
11 }
12 int main(){}

 

以上是关于bitset实现位压加法的主要内容,如果未能解决你的问题,请参考以下文章

洛谷 P3674 小清新人渣的本愿 [莫队 bitset]

利用JAVA的BitSet实现数组排序

STL详解(十五)—— bitset(位图)的模拟实现

基础算法

bzoj4810

2022-04-24:位集 Bitset 是一种能以紧凑形式存储位的数据结构。 请你实现 Bitset 类。 Bitset(int size) 用 size 个位初始化 Bitset ,所有位都是 0