#K84157. Min-Max Scaling
Min-Max Scaling
Min-Max Scaling
You are given a list of numerical values. Your task is to apply Min-Max scaling to these values. For each value \(x_i\) in the list, compute the scaled value using the formula:
\(y_i = \frac{x_i - \min(X)}{\max(X) - \min(X)}\)
If all values are identical, then every scaled value should be output as 0.0.
inputFormat
The input is given via standard input. The first line contains an integer (N) representing the number of elements. The second line contains (N) space-separated numbers.
outputFormat
Output the scaled values separated by a single space via standard output. The scaling is performed using the formula (y_i = \frac{x_i - \min(X)}{\max(X) - \min(X)}) and in the case where (\min(X) = \max(X)), output all zeros.## sample
5
1 3 5 7 9
0.0 0.25 0.5 0.75 1.0