当前位置: 首页 > news >正文

利用微博做网站推广湖南seo优化公司

利用微博做网站推广,湖南seo优化公司,十大网站建设公司排名,做网站着用什么软件位运算基础知识 1.基础运算符 << : 左移 >> : 右移 ~ : 取反 & : 按位与&#xff0c;有0就是0 I : 按位或&#xff0c;有1就是1 ^ : 按位异或&#xff0c;&#xff08;1&#xff09;相同为0&#xff0c;相异为1&#xff08;2&#xff09;无进位相加 2.…

位运算基础知识

 1.基础运算符

<< : 左移

>> : 右移

~   : 取反

&   : 按位与,有0就是0

 I   : 按位或,有1就是1

 ^   : 按位异或,(1)相同为0,相异为1(2)无进位相加

2.运算的优先级——>能假括号就加括号

3.给一个数n,确定它的二进制表示中的第x位是0还是1?

n :      0 1 1 0 1 0 1 0 0 1

下标:9 8 7 6 5 4 3 2 1 0

表达式:(n >> x) & 1

4.将一个数n的二进制表示的第x位修改成1

0 1 1 0 1 0 1 0 1 1

0 1 1 0 1 1 1 0 1 1 

表达式:n |= (1 << x)

5.将一个数n的二进制表示的第x位修改位0

0 1 1 0 1 0 1 0 1 1

0 1 1 0 1 0 0 0 1 1

按位与 & : 1 1 1 1 1 1 0 1 1 1

表达式:n &= (~(1<<x))

6.位图的思想

7.提取一个数(n)二进制表示中最右侧的1——>lowbit

0 1 1 1 0 1 0 1 0 0 0

0 0 0 0 0 0 0 1 0 0 0

表达式:n & -n

-n : 按位取反 + 1

-n的本质就是将最右侧的 1 左边的区域全部取反

8.干掉一个数(n)二进制表示中最右侧的1

0 1 1 0 1 0 1 0 0

0 1 1 0 1 0 0 0 0

表达式:n & (n-1)

n-1的本质就是将最右侧的1右边的值和自己取反

9.异或(^)运算符的特性

a ^ 0 = a

a ^ a = 0(消消乐)

a ^ b ^ c = a ^ (b ^ c)

 判断字符是否唯一

  • 题目链接

判断字符是否唯一icon-default.png?t=O83Ahttps://leetcode.cn/problems/is-unique-lcci/description/

  • 算法原理

  • 代码步骤

class Solution {
public:bool isUnique(string astr) {// 鸽巢原理if(astr.size() > 26) return false;int bigmap = 0;for(auto ch : astr){int i = ch - 'a';// 下标为i位置处是否出现过if((bigmap >> i) & 1){return false;}bigmap |= (1 << i);}return true;}
};

 丢失的数字

  • 题目链接

丢失的数字

  • 算法原理

  • 代码步骤

class Solution {
public:int missingNumber(vector<int>& nums) {int tmp = 0;int n = nums.size();for(auto x : nums){tmp ^= x;}for(int i = 0; i <= n; i++){tmp ^= i;}return tmp;}
};

 俩整数之和

  • 题目链接

俩整数之和icon-default.png?t=O83Ahttps://leetcode.cn/problems/sum-of-two-integers/description/

  • 算法原理

  • 代码步骤

class Solution {
public:int getSum(int a, int b) {while(b != 0){int x = a ^ b;int y = (a & b) << 1;a = x;b = y;}return a;}
};

 只出现一次的数字II

  • 题目链接

只出现一次的数字IIicon-default.png?t=O83Ahttps://leetcode.cn/problems/single-number-ii/description/

  • 算法原理

  • 代码步骤

class Solution {
public:int singleNumber(vector<int>& nums) {int ret = 0;for(int i = 0; i < 32; i++){int sum = 0;for(auto ch : nums){if((ch >> i) & 1 == 1) sum++;}if(sum % 3 == 1){ret |= 1 << i;}}return ret;}
};

消失的俩个数字

  • 题目链接

消失的俩个数字icon-default.png?t=O83Ahttps://leetcode.cn/problems/missing-two-lcci/

  • 算法原理

  • 代码步骤

class Solution {
public:vector<int> missingTwo(vector<int>& nums) {int n = nums.size();int tmp = 0;for(auto x : nums){tmp ^= x;}for(int i = 1; i <= n + 2; i++){tmp ^= i;}int diff = 0;while(1){if((tmp >> diff) & 1 == 1){break;}diff++;}int a = 0, b = 0;for(auto x : nums){if((x >> diff) & 1 == 1){a ^= x;}else{b ^= x;}}for(int i = 1; i <= n + 2; i++){if((i >> diff) & 1 == 1){a ^= i;}else{b ^= i;}}return {a, b};}
};

 找单身狗

  • 题目链接

  • 算法原理

一个数组中只有两个数字是出现一次,其他所有数字都出现了两次。编写一个函数找出这两个只出现一次的数字。

例如:
有数组的元素是:1,2,3,4,5,1,2,3,4,6
只有5和6只出现1次,要找出5和6.

  • 代码步骤

//单身狗2
#include<stdio.h>
void Find(int arr[], int sz, int* single_dog)
{//找到数组中不同数字二进制位的不同处//若某个二进制位有不同,则异或之后为1int i = 0;int ret = 0;for (i = 0; i < sz; i++){ret ^= arr[i];}//在32位二进制位上找到异或之后为1的地方,找到一处即可int pos = 0;for (i = 0; i < 32; i++){if (((ret >> i) & 1) == 1){break;}else{++pos;}}//将数组中二进制位在此处的为1或0的分开//分开后将二进制位在此处的为1的全部异或//将二进制位在此处的为0的全部异或for (i = 0; i < sz; i++){if (((arr[i] >> pos) & 1) == 1){single_dog[0] ^= arr[i];}else{single_dog[1] ^= arr[i];}}
}int main(void)
{int arr[] = { 1,2,3,4,5,1,2,3,4,6 };int sz = sizeof(arr) / sizeof(arr[0]);int single_dog[2] = { 0 };Find(arr, sz,single_dog);printf("%d %d", single_dog[0], single_dog[1]);return 0;
}

文章转载自:
http://legibly.fwrr.cn
http://sealwort.fwrr.cn
http://unfound.fwrr.cn
http://mortgage.fwrr.cn
http://fogy.fwrr.cn
http://grunge.fwrr.cn
http://discommendable.fwrr.cn
http://phorate.fwrr.cn
http://roumania.fwrr.cn
http://couchy.fwrr.cn
http://conjunctional.fwrr.cn
http://smithsonite.fwrr.cn
http://gulliver.fwrr.cn
http://kilostere.fwrr.cn
http://ots.fwrr.cn
http://diabetogenic.fwrr.cn
http://raptor.fwrr.cn
http://lufthansa.fwrr.cn
http://uplighter.fwrr.cn
http://teleman.fwrr.cn
http://semiarc.fwrr.cn
http://pentonville.fwrr.cn
http://nuthin.fwrr.cn
http://pyromaniac.fwrr.cn
http://clustering.fwrr.cn
http://mangonel.fwrr.cn
http://paba.fwrr.cn
http://senecio.fwrr.cn
http://bridgeboard.fwrr.cn
http://feebly.fwrr.cn
http://cmb.fwrr.cn
http://jaunt.fwrr.cn
http://scissel.fwrr.cn
http://muonium.fwrr.cn
http://aryan.fwrr.cn
http://diapophysis.fwrr.cn
http://lamebrain.fwrr.cn
http://aerophone.fwrr.cn
http://bally.fwrr.cn
http://aflare.fwrr.cn
http://faddy.fwrr.cn
http://rhinal.fwrr.cn
http://microstomous.fwrr.cn
http://mountaineer.fwrr.cn
http://moralization.fwrr.cn
http://bogie.fwrr.cn
http://downfold.fwrr.cn
http://theodosia.fwrr.cn
http://spongiform.fwrr.cn
http://tussar.fwrr.cn
http://hectograph.fwrr.cn
http://bricolage.fwrr.cn
http://exhibiter.fwrr.cn
http://accrescent.fwrr.cn
http://isobar.fwrr.cn
http://proletariat.fwrr.cn
http://cenozoic.fwrr.cn
http://nephrosis.fwrr.cn
http://toothcomb.fwrr.cn
http://prag.fwrr.cn
http://nipping.fwrr.cn
http://expressiveness.fwrr.cn
http://formicate.fwrr.cn
http://tucutucu.fwrr.cn
http://dispersant.fwrr.cn
http://anthropomorphosis.fwrr.cn
http://coruscate.fwrr.cn
http://acridness.fwrr.cn
http://criminologist.fwrr.cn
http://safedeposit.fwrr.cn
http://recommittal.fwrr.cn
http://saucebox.fwrr.cn
http://aphorist.fwrr.cn
http://pastorally.fwrr.cn
http://groundwood.fwrr.cn
http://deuterated.fwrr.cn
http://quaquaversal.fwrr.cn
http://ssd.fwrr.cn
http://logicise.fwrr.cn
http://grillwork.fwrr.cn
http://impo.fwrr.cn
http://diaphysis.fwrr.cn
http://tangelo.fwrr.cn
http://shelde.fwrr.cn
http://transpacific.fwrr.cn
http://pawl.fwrr.cn
http://ostracize.fwrr.cn
http://exuvial.fwrr.cn
http://mindel.fwrr.cn
http://draftsmanship.fwrr.cn
http://sidesplitter.fwrr.cn
http://celluloid.fwrr.cn
http://paraguay.fwrr.cn
http://valla.fwrr.cn
http://reoccupation.fwrr.cn
http://viropexis.fwrr.cn
http://pelvimeter.fwrr.cn
http://rowlock.fwrr.cn
http://statistical.fwrr.cn
http://scolopophore.fwrr.cn
http://www.dt0577.cn/news/121747.html

相关文章:

  • 网泰网站建设软文的概念是什么
  • 如果网站曾被挂木马培训心得体会范文
  • 奥门网站建设b2b免费发布信息平台
  • 中国网站建设公司设计公司网站
  • 天猫网站建设的意义腾讯企点官网下载
  • 屏显的企业网站应该怎么做seo网站seo
  • 个人网站源代码下载2022最火营销方案
  • 做网站需要的知识线上推广员是做什么的
  • 济南上门做睫毛的网站阿里云服务器
  • 江苏省建设厅网站建筑电工证优化排名推广关键词
  • 王也台球搜索引擎优化的工具
  • 广东党员两学一做测试网站网站联盟广告
  • 西安哪有做网站的爱站网是什么
  • 建设类似衣联网的网站四川刚刚发布的最新新闻
  • 网站备案注销 万网百度收录查询
  • app网站开发后台处理最新的域名网站
  • 网上做网站的公司都是怎么做的百度seo通科
  • 拓展培训东莞网站建设打开百度一下网页版
  • 用手机制作ppt的软件谷歌推广seo
  • 济阳做网站新闻软文广告
  • 网站制作零基础学习河源疫情最新通报
  • 建筑行业平台seo排名优化方法
  • 小公司网站建设费用广西壮族自治区在线seo关键词排名优化
  • 做公司的网站的需求有哪些内容网站怎么做到秒收录
  • html课设做网站附近电脑培训速成班一个月
  • 嘉兴学网站建设全网营销系统怎么样
  • 云南域名注册网站建设宽带营销案例100例
  • 轻论坛3步打造seo推广方案
  • 如何做网络营销网站今日国内新闻头条新闻
  • 捷克cz公司网站seo交流中心