WC '17 Contest 3 J2 - Certified Fresh

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 16M

Problem type
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 N (1 \le N \le 100) reviews from certified Rotten Tomatoes critics, one after another. The i-th review will either be positive (if R_i = P) or negative (if R_i = 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 10^{-5} 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, N.
N lines follow, the i-th of which consists of a single character, R_i, for i = 1 \dots N.

Output Specification

Output a single real number, the maximum Tomatometer score achieved by The Codefather.

Sample Input


Sample Output


Sample Explanation

After the first 5 reviews, The Codefather has received 3 positive reviews and 2 negative ones, resulting in a Tomatometer score of 3 / 5 = 0.6. This is the largest score that it achieves at any point in time.


There are no comments at the moment.