#C3639. Transform Sequence
Transform Sequence
Transform Sequence
You are given a sequence of N integers and an integer K. Your task is to transform the sequence by adding K to each element. Formally, for a sequence \(a_1, a_2, \dots, a_N\), you need to compute a new sequence \(b_1, b_2, \dots, b_N\) such that:
[ b_i = a_i + K \quad \text{for } i = 1, 2, \dots, N. ]
The input is provided via standard input and the transformed sequence should be written to standard output.
inputFormat
The first line of input contains two space-separated integers: N
(the number of elements in the sequence) and K
(the value to be added to each element). The second line contains N
space-separated integers representing the sequence.
outputFormat
Output a single line containing N
space-separated integers—the transformed sequence after adding K
to each element.
5 3
1 2 3 4 5
4 5 6 7 8