当前位置:网站首页>Bitmap principle code record
Bitmap principle code record
2022-07-02 04:02:00 【Hong Dayu】
#include <iostream>
#include <string>
#include <cstdint>
#include <algorithm>
#include <vector>
// The conventional bit Bit setting
#define set_bit(x,y) y|=(1<<(x))
#define check_bit(x,y) (1<<(x)&(y))?1:0
int main(void){
std::vector<int32_t> sort = {
1,3,5,7,8,2,4,6};
int32_t bitmask=0;
//little
set_bit(8,bitmask); // The brand needs to be sorted for the first time
for(int32_t i = 0 ; i < 8 ; i++){
set_bit(sort[i],bitmask);
}
for(int32_t i = 0 ; i < 9 ; i++){
if(check_bit(i,bitmask)){
std::cout << i << " ";
}
}
std::cout << std::endl;
}
bitmap It can be used to remove weight and , Non duplicate allocation index
- linux pid The way of distribution
边栏推荐
- Vite: configure IP access
- The 6th Blue Bridge Cup single chip microcomputer provincial competition
- Sword finger offer II 006 Sort the sum of two numbers in the array
- Monkey测试
- Vite: scaffold assembly
- 蓝湖的安装及使用
- 【力扣刷题】15.三数之和(双指针);17.电话号码的字母组合(递归回溯)
- Imageai installation
- First acquaintance with P4 language
- The 11th Blue Bridge Cup single chip microcomputer provincial competition
猜你喜欢
0 foundation how to learn automated testing? Follow these seven steps step by step and you will succeed
软件测试人的第一个实战项目:web端(视频教程+文档+用例库)
手撕——排序
蓝桥杯单片机省赛第八届
Raspberry pie GPIO pin controls traffic light and buzzer
[untitled]
Sorted out an ECS summer money saving secret, this time @ old users come and take it away
Lost a few hairs, and finally learned - graph traversal -dfs and BFS
Basic operations of MySQL database (based on tables)
pip 安装第三方库
随机推荐
Delete the code you wrote? Sentenced to 10 months!
Fingertips life Chapter 4 modules and packages
Three ways for programmers to learn PHP easily and put chaos out of order
The 6th Blue Bridge Cup single chip microcomputer provincial competition
The fourth provincial competition of Bluebridge cup single chip microcomputer
Blue Bridge Cup single chip microcomputer sixth temperature recorder
蓝桥杯单片机省赛第八届
潘多拉 IOT 开发板学习(RT-Thread)—— 实验1 LED 闪烁实验(学习笔记)
Go branch and loop
Demonstration description of integrated base scheme
Installation and use of blue lake
SQL:常用的 SQL 命令
Go function
Get started with Aurora 8b/10b IP core in one day (5) -- learn from the official routine of framing interface
The 8th Blue Bridge Cup single chip microcomputer provincial competition
Fluent icon demo
QT designer plug-in implementation of QT plug-in
初识string+简单用法(二)
接口调试工具模拟Post上传文件——ApiPost
u本位合约爆仓清算解决方案建议