Shooting Bet
Time limit1sMemory limit1024 MB
Given the shoot totals of A and B, find C's total, which is the bitwise XOR of the two scores.
- Level
Easy2 of 10
- Topics
- Bit manipulation, Math
- Solved
- No attempts yet
Problem
A, B, and C are attending reserve forces training again this year. The training includes a zeroing shoot where each of 10 targets is scored, and the total of the hit targets' scores is recorded. Hitting a target gives its score: 1, 2, 4, 8, 16, 32, 64, 128, 256, or 512 points, one per target. A target that is not hit gives no points. Each person can hit each target at most once.
A, B, and C bet on dinner after the training using their zeroing shoot scores. A and B shared their totals with each other, but C wanted the bet to be more exciting and did not share the score. Instead, C said:
"Every target that exactly one of you two hit, I hit. Every target that neither of you hit, or that both of you hit, I did not hit."
A and B cannot determine C's total from this alone, so they secretly asked you for help. Find C's score and help A and B!
Input
The first line contains integers and (), the zeroing shoot totals of A and B. It is guaranteed that the scores of A and B can be written as sums of target scores.
Output
Print C's score.