Lab 2 - CEN 110
Lab 2 - CEN 110
You are given a series of numbers, show the number of numbers which are greater than the average.
Input specification
The first number is the number of numbers (n) in the series where 1 < n ≤ 100.000. Then you will be given n
integer numbers where each of the is between -10.000 and 10.000.
Output specification
Just give one number which shows the number of numbers which are greater than the average of the series.
Sample Input I:
5
12345
Sample Output I:
2
You will be first given one number (n) which is followed by two series of integers (n space-separated values).
Calculate the sum of two series and show them.
Input specification
You will be given one integers (n) in the first line, and 1 ≤ n ≤ 10.000. The following two lines contain a
two series of integer numbers a[n] and b[n] where -1000 ≤ a[n], b[n] ≤ 1000.
Output specification
You will give one serie, which is the sum serie of two input series.
Sample Input II
Sample Input I
5 7
36954 5 8 4 -9 3 2
25627 -6 9 -5 8 2 5
You will be first given one number (n) which is followed by one serie of integers (n space-separated values).
Calculate the difference between max and min in the array.
Input specification
You will be given one integers (n) in the first line, and 1 ≤ n ≤ 10.000. The following line contains a serie of
integer numbers a[n] where -10000 ≤ a[n] ≤ 10000.
Output specification
Show the difference between max and min element in the serie.
Input specification
In the beginning, you will be given 2 integers:
then in the following n lines you will be given m integers which are between -10000 and 10000.
Output specification
Show m integers in n lines.
Explanation: The min of first row is 1, thus, 1 has been subtracted from the first row elements.
The min of the second row is 5. Similarly, 5 has been subtracted from the second row elements...
http://acm.epoka.edu.al:8888/en/problem-pid-c502 (3 functions - read, min, substraction)
ZScore normalization
There are several methods to put the items in the same scale. In Z-score normalization arithmetic mean is
subtracted from each data item and the result is divided by the standard deviation.
where μ is the arithmetic mean and σ is the standard deviation of the sequence.
Question: Write a program that reads a sequence of numbers and then normalizes them using ZScore.
Input specification
You will be first given a number (n) the number of numbers, where 0 ≤ n ≤ 5000. Then in the following line,
you will be given n integers which are between -50,000 and 50,000.
Output specification:
Show the normalized sequence with two digits precision.
Explanation: There are 5 numbers given. And, arithmetic mean μ = 7.8 and σ = 1.9235. If μ is subtracted
from all the numbers and then divided by σ, we have the given sequence.