P0014. Numerical valleys

Your task is to write a program that, given two natural numbers nn and rr, uses nn to print a valley with rr rows as it is shown at the instances. Notice that, the last row has rr numbers nn separated by dashes, the central dot, and rr numbers nn separated by dashes, that each row has two numbers nn less than the row immediataly below, and that the part of the middle has to be filled with as many dots as necessary.

To solve this problem, you must implement recursively the function

    int number_of_digits(int n);

that returns the number of digits of |n|, under the precondition |n| 0\ge 0.

Input

The input consists of two natural numbers nn and rr, with r>0r > 0.

Output

Your program must print a valley of rr rows using the number nn as can be seen in the instances.

Observations

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:51:24.716Z

© Jutge.org, 2006–2026.
https://jutge.org