# Problem Link:

Fool’s Programming Contest

A fool

* Author:* Amul Agarwal

*Ishaan Shah, Sanyam Shah, Sambasai Andem and Tejas Chaudhari*

**Testers:***Keyur Chaudhari*

**Editorialist:**# DIFFICULTY:

SIMPLE

# EXPLANATION:

Zeeshan gave a quiz with binary answers. It is clear that if one scores 0 in a True/False quiz, he can score full in the next attempt by just flipping his/her answers. For a particular question, if you marked True in the first attempt, mark False in the second attempt. Similarly, if you marked False in the first attempt, mark True in the second attempt.

The intended solution was to negate the last 5 bits (since the quiz had 5 problems) of the number given as input. It is equivalent to the bitwise XOR of the given number with 31 (11111 in binary). This observation of flipping the last 5 bit was to be deduced from the problem hint “5 True or False questions” and the sample input-output.

## Tester's Solution

Approach1: Xor with 31

```
#include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define tc \
int t; \
cin >> t; \
while (t--)
signed main()
{
fast;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
tc
{
int n;
cin >> n;
n = n ^ 31;
cout << n << endl;
}
}
```

## Editorialist's Solution

Approach2: Negating 5 least significant bits

```
#include<bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while(T--) {
int n;
cin >> n;
for(int b = 0; b < 5; b++) {
n ^= (1 << b);
}
cout << n << endl;
}
return 0;
}
```