首页 > 编程语言 >c++'s shift operator >> and <<

c++'s shift operator >> and <<

时间:2022-10-18 21:26:20浏览次数:31  
标签:represent use useful shift c++ operator

the use of the c++'s shift operator << and the >>

  • where we can use?
    -> we can use it to represent the 1k, 1M, or the 1G, that is very useful;
    -> we can use it to the represent the power(2, n), for example, 2^2 is the 1 << 2;

  • what does it means for the: 1 << 1 and the 1 << 31?
    -> 1 << 1: means that 0....01 left shift 1 bit, that is the 0...10, that is the 2;
    -> 1 << 31: means the 0....01 left shift 31 bit, that is the 1...0, that is the 2^31;
    -> from the above, we can make the conclusion that, for the 1 << n: means the 2^n;
    -> for the k << n, that is the $k*2^{n}$

标签:represent,use,useful,shift,c++,operator
From: https://www.cnblogs.com/GuangJI/p/16804216.html

相关文章

  • 2021ICPC沈阳站 J Luggage Lock 思路以及C++实现
    题目JLuggageLock思路我们可以将密码锁的每一个状态看成一个节点,每一个操作看成从一个节点到另一个节点的权重为1(意思是经过一次操作)的有向边,这个问题就可以看成一个......
  • C++类模型漫谈(一)
    系统基于32位,MSVC编译器,VS开发工具1、一个简单的类型TypeA,类型对象a_obj总共占8个字节。char类型a1占1个字节,但是为了考虑到32位系统存储效率,所以a1变量后面会分配3个字节......
  • C++中pair的用法
    https://blog.csdn.net/EmSoftEn/article/details/50587276?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ER......
  • 使用pybind11 来实现python 调用c++
    参考https://blog.csdn.net/luolinll1212/article/details/1060619431c++实现2编写pybind11的代码#include"pybind11/pybind11.h"#include"pybind11/numpy.h"......
  • mmdetection 生成c++ 的anchor头文件
    importosimportos.pathasospimportnumpyasnpfrommmcvimportConfigfrommmdet.modelsimportbuild_detectorimportmathimportargparseimportpickle......
  • CodeForces 709C Letters Cyclic Shift
    C.LettersCyclicShifttimelimitpertestmemorylimitpertestinputoutputsconsistingoflowercaseEnglishletters.Youhavetopickexactlyonenon-emptysubs......
  • 学习日记(C++、动态规划)
    1、121买卖股票的最佳时机classSolution{public:intmaxProfit(vector<int>&prices){intn=(int)prices.size(),ans=0;for(inti=0;i<n;++i......
  • OpenCV无缝融合应用(四)--纹理平滑(附C++源码)
    导读本期将介绍并演示OpenCV中使用textureFlattening实现图像中指定区域纹理平滑的效果。介绍OpenCV图像无缝融合-seamlessClone介绍与使用(Python/C++源码)OpenCV无缝融合......
  • OpenCV无缝融合应用(二)--指定目标颜色改变(附C++源码)
    导读本期将介绍并演示OpenCV中使用colorChange实现图像中指定目标颜色改变的效果。介绍colorChange与seamlessClone同属于SeamlessCloning部分,算法均来自下面这篇论文:​​h......
  • OpenCV无缝融合应用(三)--局部区域亮度调整(附C++源码)
    导读本期将介绍并演示OpenCV中使用illuminationChange实现图像中局部区域亮度调整的效果。介绍OpenCV图像无缝融合-seamlessClone介绍与使用(Python/C++源码)OpenCV无缝融......