Better Than How Many?
Cavendish Test Prep gives every student one line of feedback after a mock exam: how they placed against everyone else who sat it. That line is a percentile rank — the percentage of the cohort's scores that came in strictly below the student's own. Matching another student's score does not count as beating them, so somebody who ties the best score in the room is not on 100.
Task: Print the student's percentile rank against the cohort scores listed before it.
Input
The first line holds one integer n, how many cohort scores follow. Each of the next n lines holds one cohort score as a plain number, in no particular order. One final line, on its own after the cohort, holds the student's own score. The student's score may or may not also appear in the cohort, and it is never part of the cohort count n.
Output
One line holding the percentile rank as a percentage with exactly one digit after the decimal point and no % sign. A student below the whole cohort prints 0.0.
Example:
Input:
5
50
60
70
80
90
75
Output:
60.0
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