HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > "Informatics Stars" Online Contests - 2011-2014 > problem:


2012-03-02. 50567 - Input Data Normalization

"Informatics Stars" Online Contests - 2011-2014

Start: Oct.20.2012 at 10:00:00 AM
Finish: Oct.20.2012 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Contest problems

• 2011-11-3. 50588 - Processing the li...
• 2012-02-2. 50577 - Perfect Numbers...
• 2012-02-4. 50594 - Transformations
• 2012-02-5. 50768 - Where is Waldorf?
• 2012-02-7. 50704 - Connected?
• 2012-02-8. 50596 - Your Ride Is He...
• 2012-02-8. 50596 - Your Ride Is He...
• 2012-03-01. 50563 - Long Modulus
• 2012-03-02. 50567 - Input Data...
• 2012-03-04. 50597 - Drawing Diam...
• 2012-10-02. 50555 - Frequency of L...
• 2012-10-04. 50598 - Minimum Sum
• 2012-11-30. 50656 - Divisibility by 11
• 2012-11-40. 50558 - Biggest Barn
• 2012-12-10. 50546 - Average Fuel P...
• 2012-12-20. 50574 - Triangular Nu...
• 2012-12-30. 50684 - Sum of prime ...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Min Max Normalization

Shqip
In a usage in statistics, when having data examples coming from different sources, in order to be able compare them, they are needed to be normalized . This opeation refers to putting all the data to a common scale in order to negate that variable's effect on the resulting data, thus allowing underlying characteristics of the data sets to be compared. This allows data on different scales to be compared, by bringing them all to a common scale.

There are various normalization methods in statistics: Standard score normalization, Student's t-statistic, nondimensional ratios of errors, residuals, means and standard deviations, etc. The Min Max normalization is also used frequently. In this method min and max of every sample are found first, then, that sample is scaled with the new range according to the following formula:
          (b-a)*(x - min)
   f(x) = -------------- + a
             max - min
where a and b are the min and max of the new range; x is the current value of the data set which is going to be converted to; min and max are the min and max of this data set.
e.g. If we have the data: 5 3 9 7; and we want it to normalize it to the new range 1...4.
   min of the sample data is 3
   max of the sample data is 9
   a (min of the new range) is 1
   b (max of the new range) is 4
   The element value that we will convert: x (the first element of data series) is 5
Then 5 (the first element of the data series) can be converted with the following formula:
          (4-1)*(5 - 3)
   f(5) = -------------- + 1 = 2
             9 - 3
After normalizing all the elements the new data series will be:   2 1 4 3;

Question

Write a program that is going to read a two dimensinal array, and it will normalize all data to the given scale.
(All the rows will be normalized independently to the given scale.)

Input specification

The first line contains four numbers m, n, a, b.
   m is (integer) the length of the input array where 1 ≤ m ≤ 25,
   n is (integer) the height of the input array where 1 ≤ n ≤ 3000,
   a, b are (floating point numbers) the min and max of the new range where -10000 ≤ a, b ≤ 10000)).
Starting from the second line, we will have m numbers in the following n lines representing the input data. The values stored in the input array A[n][m] will be integers in the range from   -150000 to  +150000,

Output specification

Give the normalized array m numbers in n lines in the same order as the input data. Each number in the line will be separated by a space. Output numbers' data type will be double with at most 3 digit precision.
When calculating the 3 digit precision, the 4th digit will be rounded (up or down) to the third digit.

Sample Run

Sample Input 1 Sample Output 1
4 5 1 10
1 0 2 3
8 4 7 5
2 0 3 2
5 5 3 2
5 4 5 5
4 1 7 10
10 1 7.75 3.25
7 1 10 7
10 10 4 1
10 1 10 10
Sample Input 2 Sample Output 2
3 6 0 1
5 4 1
5 9 6
-3 -3 0
8 3 6
13 11 12
4 6 10
1 0.75 0
0 1 0.25
0 0 1
1 0 0.6
1 0 0.5
0 0.333 1

Для отправки решений необходимо выполнить вход.

www.contester.ru