X3 - COCI
Mirko has recently been visited by extraterrestrials from planet X3, where everyone’s name is a positive integer. All residents of the planet know each other. Two X3-ians calculate the strength of their friendship by converting their names to binary, aligning them one under the other, and writing adigit in each column: 0 if the two binary digits in that column are equal, 1 if they differ. The binary result is then converted back to the decimal system.
For example, the friendship value of 19 and 10 equals 25:
The value of a planet in the Universe is defined as the sum of all friendship values. Mirko has asked you to help him compute the value of planet X3!
Input:
2
19
10Output:
25Input:
3
7
3
5Output:
12Input:
5
9
13
1
9
6Output:
84Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.