UVa 575 - Skew Binary

Summary
Convert a number from base $$2^{k+1} - 1$$ to decimal.

Explanation
Standard base-conversion to decimal. Start at the Least Significant Bit (LSB) and work your way to the Most Significant Bit (MSB).

Gotcha's

 * Input of 0 terminates.

Input
10120 200000000000000000000000000000 10 1000000000000000000000000000000 11 100 11111000001110000101101102000 0

Output
44 2147483646 3 2147483647 4 7 1041110737