Answer the question
In order to leave comments, you need to log in
How did they get 6 pairs out of 4 numbers?
Given a set of N positive integers. All possible pairs are formed from these numbers (two elements that are in different places in the set are considered a pair, the order of numbers in a pair is not taken into account) , in each pair the sum and product of the elements are calculated. It is necessary to determine the number of pairs whose sum is odd and whose product is divisible by 3.
Description of input and output data.
The first line of the input contains the number of numbers N (1 ≤ N ≤ 1000). Each of the following N lines contains one natural number not exceeding 100.
Example input:
4
1
2
3
4
Example output for the above example input:
2
You can make 6 pairs out of 4 numbers. In this case, two pairs satisfy the conditions: (2, 3) and (3, 4). The sums of the numbers in these pairs (5 and 7) are odd, and the products (6 and 12) are divisible by 3. All other pairs do not have at least one of these conditions.
How do they get 6 pairs out of 4 numbers?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question