Scaling for the Model
Lumen Analytics feeds house-price features into a model that treats all of its inputs as if they lived on one scale. Floor area in square metres and number of bedrooms plainly do not, so each column is rescaled before training: the smallest value in the column becomes 0, the largest becomes 1, and every other value lands proportionally between them. The rescaled column has to line up row for row with the original, so nothing may be reordered on the way out.
Task: Print the rescaled version of every value in the column.
Input
The first line holds one integer n, how many values follow. Each of the next n lines holds one value as a plain number, in the row order of the original column. Values are not sorted, and the largest and smallest are not necessarily the first and last lines.
Output
n lines, one per input value, in the same order the values arrived. Each line holds that value rescaled, with exactly two digits after the decimal point. The smallest value prints as 0.00 and the largest as 1.00.
Example:
Input:
4
10
20
15
30
Output:
0.00
0.50
0.25
1.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in