跳到正文

个人记录

位运算加法

TGLXJ约 1 分钟
原文

这是 2025年11月17日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟

版本

  1. v2当前
  2. v1

#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int c;
while(b){
c=a;
a=a^b;
b=(c&b)<<1;
}
printf(“%d”,a);
return 0;
}