P0018. Azathoth numbers P53202


Statement
 

pdf   zip

thehtml

In the center of the universe the origin of the chaos resides: a blind and crazy god called Azathoth. In his madness, Azathoth writes the numbers in basis 50, and each of the digits in basis 50 is written in binary basis. Moreover, he writes a dot in the beginning, in the end and between each digit.

For instance, 115 = 2 · 501 + 15 · 500. As 2 in binary basis is |10|, and 15 in binary basis is |1111|, Azathoth would write “.10.1111.”.

Your task is to write a program that prints each given number with the Azathoth system.

Observation

Your program must implement and use the procedure

void binary_print(int n);

that prints any natural number |n| in binary (zero included).

Hint

Use recursion.

Input

The input is a sequence of natural numbers.

Output

Your program must print each natural number in decimal and also in Azathoth system one per line and following the format of the instances.

Public test cases
  • Input

    115
    6
    31
    49
    50
    51
    2532
    0
    1
    1122334455
    

    Output

    115 = .10.1111.
    6 = .110.
    31 = .11111.
    49 = .110001.
    50 = .1.0.
    51 = .1.1.
    2532 = .1.0.100000.
    0 = .0.
    1 = .1.
    1122334455 = .11.11101.11100.100001.100111.101.
    
  • Input

    6250000
    

    Output

    6250000 = .1.0.0.0.0.
    
  • Information
    Author
    Professorat de P1
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++