Select by divisors
Problem
Given an array of numbers. It is necessary to write to another array all three-digit numbers of the original list that are divisible by
K
and are not divisible by
M
.
Input
The first line contains the number of numbers -
N
. The second line contains space-separated
N
numbers – array elements (positive integers no more than 10
5). It is guaranteed that
0 < N <= 10000
. The third line contains two numbers separated by a space –
K
(
1 < K <= N
) and
M
(
1 <= M <= N< /code>).
Imprint
The program should display all the elements of the new array in one line, separating them with spaces. If there were no suitable elements in the array, the program should print the number 0.
Examples
# |
Input |
Output |
1 |
6
28 204 103 804 105 106
2 3
| 106 |
Запрещенные операторы: sort
; min
; max
; reverse
; count
; sum
; index