#P3495. Bitwise XOR of Arithmetic Progression
Bitwise XOR of Arithmetic Progression
Description
Write a program that, given three positive integers x, y and z (x, y, z < 232, x ≤ y), computes the bitwise exclusive disjunction (XOR) of the arithmetic progression x, x + z, x + 2z, …, x + kz, where k is the largest integer such that x + kz ≤ y.
Input
The input contains multiple test cases. Each test case consists of three integers x, y, z separated by single spaces on a separate line. There are neither leading or trailing blanks nor empty lines. The input ends once EOF is met.
Output
For each test case, output the value of on a separate line. There should be neither leading or trailing spaces nor empty lines.
2 173 11
48
Source
POJ Founder Monthly Contest – 2008.01.31, frkstyc