Insert by condition
Problem
Given an array of
N
positive elements greater than 1 (
\(2<=N<=100\)). Insert the value
a
before all elements that are multiples of
a
.
Input
The first line contains
N
- the number of array elements. The second line contains the number
a
. The third line contains
N
numbers - the values array elements.
Imprint
Print the resulting array on one line.
Examples
# |
Input |
Output |
1 |
5
2
43 50 76 84 100 |
43 2 50 2 76 2 84 2 100 |
Запрещенные операторы: insert
; pop
; del
; remove
; index