Numbers in base -2 P93533


Statement
 

pdf   zip

html

Write a program to print numbers in base -2.

Input

Input consists of several integer numbers, each with at most nine digits.

Output

For every given number, print it in base -2 following the format of the example.

Public test cases
  • Input

    0
    1
    2
    3
    -1
    -2
    -3
    -6
    10
    999999999
    -999999999
    

    Output

    0: 0
    1: 1
    2: 110
    3: 111
    -1: 11
    -2: 10
    -3: 1101
    -6: 1110
    10: 11110
    999999999: 1001100111011111101111000000011
    -999999999: 11000101101001010100101000000001
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Python