##### Canadian Computing Competition: 2020 Stage 1, Senior #5

On their way to the contest grounds, Josh, his coach, and his teammates decide to stop at a burger joint that offers distinct burger menu items. After ordering their favourite burgers, the team members line up, with the coach in the first position and Josh last, to pick up their burgers. Unfortunately, the coach forgot what he ordered. He picks a burger at random and walks away. The other team members, in sequence, pick up their favourite burger if available, or a random remaining burger if there are no more of their favourite burger. What is the probability that Josh, being last in line, will get to eat his favourite burger?

#### Input Specification

The first line contains the number , the total number of people and burgers. The next line contains numbers, the -th being , denoting the item number of the -th person's favourite burger. The first person in line is the coach, and the -th person is Josh.

For of the available marks, and .

For an additional of the available marks, .

#### Output Specification

Output a single number , the probability that Josh will get to eat his favourite burger, . If the correct answer is , the grader will view correct if .

#### Sample Input 1

```
3
1 2 3
```

#### Output for Sample Input 1

`0.5`

#### Explanation of Output for Sample Input 1

The coach randomly chooses between the three burgers. With probability , he chooses his favourite burger (burger 1), and Josh gets to eat his favourite burger (burger ). With probability , he chooses Josh's favourite burger, and Josh fails to eat his favourite burger. With probability , he chooses the second person's burger, there is a chance that the second person chooses Josh's burger, denying Josh the pleasure of eating his favourite burger.

#### Sample Input 2

```
7
1 2 3 1 1 2 3
```

#### Output for Sample Input 2

`0.57142857`

## Comments

After some calculation I got that for people having distinct burgers, the probability that the last person gets their burger is

Pls check my math.

This comment is hidden due to too much negative feedback. Show it anyway.

2019 Canadian Mathematical Olympiad - Qualifying Repechage Problem 7:

There are n passengers in a line, waiting to board a plane with n seats. For 1 ≤ k ≤ n, the k th passenger in line has a ticket for the k th seat. However, the first passenger ignores his ticket, and decides to sit in a seat at random. Thereafter, each passenger sits as follows: If his/her assigned is empty, then he/she sits in it. Otherwise, he/she sits in an empty seat at random. How many different ways can all n passengers be seated?

hmmmmm...

This comment is hidden due to too much negative feedback. Show it anyway.

Congratulations on having the comment with the most amount of downvotes on DMOJ!

thx!

This comment is hidden due to too much negative feedback. Show it anyway.

Were this year's S3 and S4 too stringy as well? And I assume that S2 was much too graphy for your tastes. In my personal opinion, S1 was surely too implementy compared to other S1s.