Bases and bars P62355


Statement
 

pdf   zip

Write a program that, given two numbers nn and bb, prints the digits of nn in base bb as shown in the examples. For every digit dd, print a line with dd capital exes. Print the digits from right to left.

Input

Input consists of a natural number nn between 1 and 10610^6, followed by a natural number bb between 2 and 100.

Output

For every digit dd of nn represented in base bb, and starting from the digit with less weight, print a line of size dd made up of only ‘X’. Print a line with 10 dashes at the beginning and at the end of the output.

Public test cases
  • Input

    1984 10
    

    Output

    ----------
    XXXX
    XXXXXXXX
    XXXXXXXXX
    X
    ----------
    
  • Input

    42 2
    

    Output

    ----------
    
    X
    
    X
    
    X
    ----------
    
  • Input

    19 20
    

    Output

    ----------
    XXXXXXXXXXXXXXXXXXX
    ----------
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Python
    User solutions
    C++ Python