#K34702. Paint Triangle
Paint Triangle
Paint Triangle
You are given two integers, base (b) and height (h), that describe an isosceles triangle. The triangle must be painted using a numerical pattern where each row i (1-indexed) is filled with the digit i.
The number of digits on row i follows the formula \(1+2(i-1)\), and the remaining spaces on each side of the digits are filled with the '-' character. The total width of each row is equal to b. It is guaranteed that the provided b and h yield a valid centered triangle.
For example, for b = 7
and h = 4
the triangle will be:
---1--- --222-- -33333- 4444444
Your task is to implement this logic and produce the corresponding painted triangle as the output.
inputFormat
The input consists of two integers read from stdin: the first integer denotes the base width b and the second integer denotes the height h of the triangle.
You can assume that the inputs are valid and that they form a valid isosceles triangle as described.
outputFormat
The output should be the painted triangle printed to stdout, where each line represents a row of the triangle. Each line should not contain any extra spaces or characters.
## sample7
4
---1---
--222--
-33333-
4444444
</p>