-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEven_Subset_Xor.cpp
More file actions
46 lines (43 loc) · 903 Bytes
/
Even_Subset_Xor.cpp
File metadata and controls
46 lines (43 loc) · 903 Bytes
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 <bits/stdc++.h>
using namespace std;
int main()
{
int t, a, b = 0, c, n;
cin >> t;
while (t--)
{
cin >> a;
int s[a];
int i = 0;
for (c = 1; c < 1000; c++)
{
n = c;
int binaryNum[32];
int i = 0;
while (n > 0)
{
binaryNum[i] = n % 2;
n = n / 2;
i++;
}
for (int j = i - 1; j >= 0; j--)
{
if (binaryNum[j] == 1)
{
b++;
}
}
if (b % 2 == 0)
{
for (int i = 0; i < a; i++)
{
s[i] = c;
}
}for (int i = 0; i < a; i++)
{
cout<<s[i];
}
}
}
return 0;
}