-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
59 lines (48 loc) · 938 Bytes
/
test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<bits/stdc++.h>
using namespace std;
int main()
{
// int a[5] = {10,15,20,25,30};
// int n = (1<<5);
// int flag = 0;
// for(int i=1; i<n; i++)
// {
// int count = 0;
// int k = 0;
// int j = i;
// while(j)
// {
// if(j&1) count+=a[k];
// k++;
// j = j>>1;
// }
// if(count==68)
// {
// flag = 1;
// break;
// }
// }
// if(flag) cout<<"YES"<<endl;
// else cout<<"NO"<<endl;
int a[10] = {1,2,3,4,5,7,4,3,2,1};
int k = 0;
for(int i=0; i<10; i++)
{
k^=a[i];
}
int j = 0;
int temp = k;
while (temp)
{
if(temp&1) break;
j++;
temp = temp>>1;
}
int un1=0;
for(int i=0; i<10; i++)
{
if(a[i]&(1<<j)) un1^=a[i];
}
cout<<un1<<" "<<(k^un1)<<endl;
return 0;
}