#C745. Increment Number Array
Increment Number Array
Increment Number Array
You are given an array of digits representing a non-negative integer and an integer increment value. Your task is to add the increment to the number represented by the array and output the resulting number as an array of its digits.
For example, if the array is [1, 2, 3] and the increment is 7, the result is [1, 3, 0].
Mathematically, if the number is defined as (N = d_0 \times 10^{n-1} + d_1 \times 10^{n-2} + \cdots + d_{n-1}), then you need to compute (N + increment) and output its digits.
inputFormat
The input is read from standard input and follows this format:
- The first line contains an integer (n), the number of digits in the array.
- The second line contains (n) space-separated digits (each a single digit from 0 to 9).
- The third line contains an integer representing the increment value.
outputFormat
Output the resulting number's digits separated by a space to standard output.## sample
3
1 2 3
7
1 3 0