All problems

Scaling Scores to 0-1

mediumPythonNumPyElement-wise

Fenwick College's science fair lets each judge score projects however they like, so one judge's numbers might run from 40 to 90 while another's run from 3 to 8. Before the scores can share a bar chart they are put on a common footing: the lowest score that judge gave sits at 0, the highest sits at 1, and every other score lands proportionally in between. Every judge in the data used at least two different scores, so a judge's highest and lowest are never the same number.

Task: Print one judge's scores rescaled onto that 0-to-1 footing, keeping the projects in the order the scores were given.

Input

The first line holds a single integer n, the number of scores. Each of the next n lines holds one score, which may carry decimals. The largest and the smallest are guaranteed to differ.

Output

One line holding n rescaled values, in the input order, separated by single spaces, each with two digits after the decimal point. The judge's smallest score 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

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…