Separating in lines P93424


Statement
 

pdf   zip

Given a natural number nn, a base bb, and a natural number qq, print nn in base bb, but placing the digits of nn in groups of qq at every line.

Input

Input consists of several cases, each with n>0n > 0, 2b102 \le b \le 10, and q>0q > 0.

Output

For every case, print nn in base bb, but placing qq digits at every line. If the number of digits of nn in base bb is not a multiple of qq, the first line must be the shortest. Print a line with 10 dashes at the end of every case.

Observation

You should not use vectors or alike to solve this problem.

Public test cases
  • Input

    12345 10 3
    123456 10 3
    1234567 10 3
    12 10 3
    14 2 1
    1000000000 2 10
    

    Output

    12
    345
    ----------
    123
    456
    ----------
    1
    234
    567
    ----------
    12
    ----------
    1
    1
    1
    0
    ----------
    1110111001
    1010110010
    1000000000
    ----------
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++