Woburn Challenge 2017-18 Round 3 - Junior Division
A new science fiction psychological thriller action-comedy film, The Codefather, is being released this weekend! You'd love to go see it, but you'll first need to convince your friends that it'll be good. Fortunately, trusted movie review websites such as Rotten Tomatoes exist for this purpose!
Following its release in theatres, The Codefather will receive a
series of reviews from certified Rotten Tomatoes
critics, one after another. The -th review will either be positive
(if P
) or negative (if N
).
At any given point in time after its first review, each movie on Rotten Tomatoes is considered to have a certain Tomatometer score. This score is a real number, computed as the number of positive reviews received so far divided by the total number of reviews received so far.
You're concerned that The Codefather's final Tomatometer score may end up not being too high, as general audiences may not grasp its subtle competitive programming-driven writing. However, if you keep refreshing its Rotten Tomatoes page as new reviews come in, maybe you can catch a point in time at which it has a higher score, and take a screenshot of it to show to your friends! Determine the maximum Tomatometer score which The Codefather will reach at any point after its first review.
Your answer must have at most absolute or relative error compared to the judge's answer to be considered correct.
Input Specification
The first line of input consists of a single integer, .
lines follow, the -th of which consists of a single character,
, for .
Output Specification
Output a single real number, the maximum Tomatometer score achieved by The Codefather.
Sample Input
7
N
P
N
P
P
N
P
Sample Output
0.6
Sample Explanation
After the first reviews, The Codefather has received 3 positive reviews and negative ones, resulting in a Tomatometer score of . This is the largest score that it achieves at any point in time.
Comments