Problems
Given a list of integers, output the sum of those that are divisors of the given number, and the sum of those that are multiples of the given number.
For example, if the 6 integers 2, 3, 5, 12, 18, 24 are given and the input number is 12:
The divisors of 12 among the given integers are
2, 3, 12.The multiples of 12 among the given integers are
12, 24.
Input
The first line contains an integer
The second line contains the nnn integers.
The third line contains the integer
Output
Print two lines:
The sum of all divisors of mmm among the given integers.
The sum of all multiples of mmm among the given integers.
Example
6
2 3 5 12 18 24
12
17
36
Tag
Source
JUNGOL - comkiwer