UVa 575

From Algorithmist
Jump to navigation Jump to search

575 - Skew Binary[edit]

Summary[edit]

Convert a number from base to decimal.

Explanation[edit]

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

Gotcha's[edit]

  • Input of 0 terminates.

Notes[edit]

  • The output will fit nicely into a 32-bit int.

Input[edit]

10120
200000000000000000000000000000
10
1000000000000000000000000000000
11
100
11111000001110000101101102000
0

Output[edit]

44
2147483646
3
2147483647
4
7
1041110737

Solutions[edit]