-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1026.cpp
46 lines (42 loc) · 925 Bytes
/
1026.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
{
long long int arr[32],brr[32],crr[32],sum=0,ans=0;
for(int i=0;i<32;i++)
{
arr[i]=0;
brr[i]=0;
crr[i]=0;
}
for(int i=0;i<32;i++)
{
if(a==0&&b==0) break;
if(a!=0)
{
arr[i]=a%2;
a=a/2;
}
if(b!=0)
{
brr[i]=b%2;
b=b/2;
}
if(arr[i]==brr[i])
crr[i]=0;
else crr[i]=1;
if(a==0&&b==0) break;
}
reverse(crr,crr+32);
for(int j=31,i=0;j>=0;j--,i++)
{
sum+=(pow(2,i)*(crr[j]));
}
cout<<sum<<endl;
sum=0,ans=0;
}
return 0;
}