Bases and bars P62355


Statement
 

pdf   zip

thehtml

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

Input

Input consists of a natural number n between 1 and 106, followed by a natural number b between 2 and 100.

Output

For every digit d of n represented in base b, and starting from the digit with less weight, print a line of size d 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