All problems

How Unusual Is This Value?

mediumPythonStatistics

Meridian Freight times how long each depot takes to load a truck. A slow load is not news on its own — a load that is slow for that particular depot is. So the alerting dashboard converts one load time into a z-score: how many standard deviations that time sits above or below the depot's own normal. The history supplied is treated as the depot's complete population, not as a sample of something larger.

Task: Print the z-score of the queried load time against the history that comes before it.

Input

The first line holds one integer n, how many history values follow. Each of the next n lines holds one history value as a plain number. One final line, on its own after the history, holds the load time being queried. That queried time may or may not also appear in the history.

Output

One line holding the z-score with exactly two digits after the decimal point. A time above the depot's average gives a positive number and one below gives a negative number; the sign is part of the answer.

A depot can have a history in which every recorded time is identical. There are no deviations to count there, so the dashboard has no ruler and reports 0.00 — whatever the queried time is, including one that never appeared in the history. The program must print that rather than stop with an error.

Example:

Input:
5
10
12
14
16
18
18

Output:
1.41

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…