#C13694. Process Data - Sum of Squares, Product, and Zero Count
Process Data - Sum of Squares, Product, and Zero Count
Process Data - Sum of Squares, Product, and Zero Count
You are given a list of integers. Your task is to compute three values:
- The sum of the squares of all negative integers, i.e. \(\sum_{x<0} x^2\).
- The product of all positive odd integers. If there are no positive odd integers, the product is defined as 1.
- The count of zeros present in the list.
Input/Output Requirement: The input is provided via standard input and the output should be printed to standard output.
Input Format: The first line contains an integer \(n\) denoting the number of elements in the list. The second line contains \(n\) space-separated integers. If \(n = 0\), the second line may be empty.
Output Format: Print three space-separated integers corresponding to the required values in the order: sum of squares of negatives, product of positive odd numbers, and the count of zeros.
Examples:
Input: 6 1 -2 3 0 -4 5</p>Output: 20 15 1
Note: For instance, in the sample input above:
- The negatives are -2 and -4, so the sum is \((-2)^2 + (-4)^2 = 4 + 16 = 20\).
- The positive odd numbers are 1, 3, and 5; their product is \(1 \times 3 \times 5 = 15\).
- There is one zero in the list.
inputFormat
The first line contains an integer n (0 ≤ n ≤ 10^5) representing the number of elements. The second line contains n space-separated integers.
outputFormat
Output three space-separated integers: the sum of squares of negative numbers, the product of positive odd numbers, and the count of zeros.## sample
6
1 -2 3 0 -4 5
20 15 1