P0017. Maya numbers P54711


Statement
 

pdf   zip

html

The Mayas were people that lived mainly in the south of the place that today is Mexico and in Central America, establishing one of the most important mesoamerican cultures before the arrival of the Spaniards. The Mayas developed the concept of zero, and their sophisticated mathematics used a vigesimal system of numeration (that is, in base 20).

The numerals were formed by three symbols; the zero (with form of shell), the one (with form of point) and the five (with form of horizontal bar). For instance, number thirteen was written with three points disposed horizontally above of two bars, one over the other one. The following figure shows how the numbers from zero to nineteen were represented:

The numbers after the nineteenth were written vertically towards up in powers of twenty. For instance, the thirty-three was written like twenty over thirteen, that is, a point (twenty) over three points (three) over two bars (ten). Thus, 33 = 1 · 201 + 13 · 200 = 1 · 20 + (3 + 2 · 5). On arriving at 400, another power of twenty was used. The Mayas wrote then 649 like a point over two points over two bars over four points over one bar, since 649 = 1 · 202 + 12 · 201 + 9 · 200 = 1 · 400 + (2 + 2 · 5) · 20 + (4 + 1 · 5).

The following picture shows an engraving of the 2nd century found at La Mojarra, near Veracruz. The first column contains the number 1326589, corresponding to 8·204+5·203+16·202+9·20+9.

Your task is to write a program that reads numbers and prints them using the maya system.

Input

The input is a sequence of natural numbers.

Output

Your program must print each natural number of the sequence in decimal and in the maya system, following the instances of the format. The shell is that represents 0 must be written as a “zero”. A horitzontal bar is formed by five dashes (no underlines).

Public test cases
  • Input

    13
    33
    649
    0
    1326589
    

    Output

    13
    ...
    -----
    -----
    33
    .
    ...
    -----
    -----
    649
    .
    ..
    -----
    -----
    ....
    -----
    0
    zero
    1326589
    ...
    -----
    -----
    .
    -----
    -----
    -----
    ....
    -----
    ....
    -----
    
  • Input

    160000
    

    Output

    160000
    .
    zero
    zero
    zero
    zero
    
  • Input

    
            
                                

    Output

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