#include <iostream>
#include <vector>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int yihuo=a^b;
int jinwei=(a&b)<<1;
while(jinwei!=0)
{
int tmp1=yihuo^jinwei;
int tmp2=(yihuo&jinwei)<<1;
yihuo=tmp1;
jinwei=tmp2;
}
cout<<yihuo<<endl;
}
用位运算实现两整数相加
最新推荐文章于 2022-04-01 14:47:18 发布