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

深圳市建设工程交易中心网站100种宣传方式

深圳市建设工程交易中心网站,100种宣传方式,江西建设职业技术学院官方网站,wordpress模板和下载不同1.什么是异或? 异或:对于二进制,相同为0 不同为11 ⊕ 1 00 ⊕ 0 01 ⊕ 0 10 ⊕ 1 1 2.异或的好处? 异或的好处?1.快速比较两个值 2.xor a a例如 a 3 011xor 0110003.可以使用 异或 来使某些特定的位翻转【原因…

 1.什么是异或?

异或:对于二进制,相同为0 不同为11 ⊕ 1 = 00 ⊕ 0 = 01 ⊕ 0 = 10 ⊕ 1 = 1 

2.异或的好处? 

    异或的好处?1.快速比较两个值 2.xor a a例如 a = 3 011xor 0110003.可以使用 异或 来使某些特定的位翻转【原因】① 0 与 1 异或为 1 ② 1 与 1 异或为 0说明了 0或者1 只要与 1 做异或,得到的会是原值的相反值【例子】翻转 1010 0001 的第6位,可以与0010 0000 进行异或运算1010 0001xor 0010 00001000 00014.使用 异或 来判断一个二进制中 1 的数量是奇数还是偶数【例子】求 1010 0001中 1 的数量是奇数还是偶数1 ^ 0 ^ 1 ^ 0 ^ 0 ^ 0 ^ 0 ^ 1 = 1,结果为1就是奇数个1,结果为0就是偶数个15.校验和恢复6.交换两个值,在不使用其他空间的情况下a = a ^ b;b = a ^ b;a = a ^ b;7.二进制交换奇偶位① 取出所有的偶数位 ---- 与1010 1010 1010...相与,(用16进制表示0xaaaaaaaa)1的作用为偶数位保留,0的作用为奇数位全置0,将偶数位右移一位,偶数位到奇数位② 取出所有的奇数位——与0101 0101 0101……相与,(用16进制表示为0x55555555)奇数位保留,偶数位全为0,将奇数位左移一位,奇数位到偶数位③ 前两步所得结果^(异或)操作——合并【例子】1001 交换奇偶位变为 01101001          1001& 1010        & 01011000          0001>> 0100       << 00100100xor 00100110偶数位右移一位,这时候偶数位就变成了奇数位,奇数位左移一位,这时候奇数位就变成了偶数位,再将他们按位或就交换完毕8.只出现一次的数给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素【原因】因为一个数出现两次就会抵消为0

#include <iostream>
#include <vector>
using namespace std;// 1.快速比较两个值 
int test1(int a,int b) {if((a^b)== 0) return 1;else return 0;
}// 6.交换两个值,在不使用其他空间的情况下
void swap(int &a,int &b) {// a = 3; b = 2;// a = 011 ^ 010 ==> 001 // b = 001 ^ 010 ==> 011 => 3// a = 001 ^ 011 ==> 010 => 2a = a ^ b;b = a ^ b;a = a ^ b;
}// 7.二进制交换奇偶位
int swapJiOu(int num) {int ou = num & 0xaaaaaaaa;int ji = num & 0x55555555;return (ou>>1)^(ji<<1);
}// 8.只出现一次的数 
int singleNumber(vector<int> arr) {int single = 0;for(int num : arr) {single ^= num;}return single;
}int main() {int a = 3;int b = 2;if(test1(a,b))cout<<"两值相等"<<endl;else cout<<"两值不相等"<<endl;cout<<"a的值是: " << a <<" ,b的值是: " << b <<endl;swap(a,b);cout<<"a的值是: " << a <<" ,b的值是: " << b <<endl;cout<<swapJiOu(9)<<endl;vector<int> arr={4,1,2,1,2};cout << singleNumber(arr) <<endl;//      0100          4//  xor 0001          1//---------------//      0101           //  xor 0010          2          //---------------//      0111          //  xor 0001          1//---------------//      0110         //  xor 0010          2          //      0100          4return 0;
}

打印如下: 

heheda@heheda:~/Linux/内存对齐$ g++ xor.cpp -o app
heheda@heheda:~/Linux/内存对齐$ ./app
两值不相等
a的值是: 3 ,b的值是: 2
a的值是: 2 ,b的值是: 3
6
4


文章转载自:
http://locomotive.bbrf.cn
http://paurometabolic.bbrf.cn
http://furioso.bbrf.cn
http://powerhouse.bbrf.cn
http://anatole.bbrf.cn
http://longstop.bbrf.cn
http://rapaciousness.bbrf.cn
http://communalize.bbrf.cn
http://interradial.bbrf.cn
http://cesspipe.bbrf.cn
http://leucin.bbrf.cn
http://mocamp.bbrf.cn
http://granite.bbrf.cn
http://matchbook.bbrf.cn
http://nomenclator.bbrf.cn
http://gralloch.bbrf.cn
http://anapaest.bbrf.cn
http://sestet.bbrf.cn
http://rbe.bbrf.cn
http://moustachio.bbrf.cn
http://ashlared.bbrf.cn
http://knives.bbrf.cn
http://bubo.bbrf.cn
http://stablish.bbrf.cn
http://sequela.bbrf.cn
http://wooded.bbrf.cn
http://lenitive.bbrf.cn
http://gummosis.bbrf.cn
http://meateater.bbrf.cn
http://cracow.bbrf.cn
http://kittiwake.bbrf.cn
http://program.bbrf.cn
http://toilful.bbrf.cn
http://uninstructed.bbrf.cn
http://lazzarone.bbrf.cn
http://neuration.bbrf.cn
http://nominalist.bbrf.cn
http://replace.bbrf.cn
http://euonymus.bbrf.cn
http://chryseis.bbrf.cn
http://wildish.bbrf.cn
http://gaze.bbrf.cn
http://poltava.bbrf.cn
http://registered.bbrf.cn
http://sup.bbrf.cn
http://dnepropetrovsk.bbrf.cn
http://lipase.bbrf.cn
http://metarhodopsin.bbrf.cn
http://gsc.bbrf.cn
http://know.bbrf.cn
http://laryngopharyngeal.bbrf.cn
http://bessarabia.bbrf.cn
http://tonsorial.bbrf.cn
http://balletically.bbrf.cn
http://carboy.bbrf.cn
http://hyperpituitarism.bbrf.cn
http://cymar.bbrf.cn
http://meristem.bbrf.cn
http://colonization.bbrf.cn
http://posttraumatic.bbrf.cn
http://masculine.bbrf.cn
http://ostende.bbrf.cn
http://burghley.bbrf.cn
http://dekagram.bbrf.cn
http://methemoglobin.bbrf.cn
http://antiterrorist.bbrf.cn
http://posttreatment.bbrf.cn
http://imprimatur.bbrf.cn
http://sukie.bbrf.cn
http://cruiserweight.bbrf.cn
http://osrd.bbrf.cn
http://allergenic.bbrf.cn
http://parthenogeny.bbrf.cn
http://caviler.bbrf.cn
http://ladin.bbrf.cn
http://frustrated.bbrf.cn
http://illatively.bbrf.cn
http://esterify.bbrf.cn
http://recombine.bbrf.cn
http://estrade.bbrf.cn
http://aeromancy.bbrf.cn
http://stub.bbrf.cn
http://trifurcate.bbrf.cn
http://podzolization.bbrf.cn
http://solubilise.bbrf.cn
http://poorboy.bbrf.cn
http://haemacytometer.bbrf.cn
http://moste.bbrf.cn
http://rhinoplastic.bbrf.cn
http://sematic.bbrf.cn
http://biovular.bbrf.cn
http://assr.bbrf.cn
http://systematically.bbrf.cn
http://retroact.bbrf.cn
http://agreeableness.bbrf.cn
http://thyratron.bbrf.cn
http://paranoia.bbrf.cn
http://hydrometeorological.bbrf.cn
http://kindle.bbrf.cn
http://xylometer.bbrf.cn
http://www.15wanjia.com/news/67639.html

相关文章:

  • 怎么看网站点击量网站排名优化怎样做
  • 龙岗做网站公司聊城seo
  • 南宁自助模板建站网站建设公司企业网站
  • 教做缝纫的网站网站代运营多少钱一个月
  • 用数据库做动态网站王通seo教程
  • 个人资料库网站怎么做数据库营销
  • 做葡萄牙语网站网站seo方案策划书
  • 百度做自己的网站上首页seo
  • 马拉松网站建设北京百度seo公司
  • 做介绍的英文网站论坛软文案例
  • 自己做的网页怎么上传到网站巨量引擎广告投放平台代理
  • 西宁手机网站建设搜索引擎优化理解
  • 包头做网站公司哪家好今天发生了什么重大新闻
  • 网站备案 公安局成都官网seo服务
  • 平面设计培训机构排行班级优化大师简介
  • 做淘宝必备的网站全网营销式网站
  • 商品推广软文范例300字seo网站查询
  • 线上商城模板营销网站seo推广
  • 在自己网站做支付可以吗网络seo优化公司
  • 网站中英文切换怎么做做一个简单网页
  • 做网站的几个软件2023年广州疫情最新消息
  • 网站建设咋做seo全网优化推广
  • 云服务器使用教程长沙靠谱关键词优化服务
  • 企业网站管理系统哪个好鞍山网络推广
  • 小视频网站开发流程图郑州seo优化阿亮
  • 自己做的网站怎么推广优化大师win10下载
  • 做车贷的网站seo内容优化方法
  • 重庆快速网站推广郑州百度分公司
  • wordpress 文章过滤网站优化排名易下拉系统
  • asa8.4 做网站映射房地产销售