Preparing NOJ

Drunk Passenger

1000ms 1048576K

Description:

Due to COVID-19, social distancing is applied in our daily life to prevent the spread of the disease. It changes our living styles a lot, especially the way of traveling. Now, many carriers cancel non-reserved seats and introduce seating rules to ensure that the distance between any two passengers is long enough.

On your trip to the 2022 ICPC World Finals, you take a flight. The airplane provides $$$n$$$ reserved seats to $$$n$$$ passengers. The passengers must queue up first; then they board the airplane one by one. You are the last passenger to board, since you are at the end of the queue. Unfortunately, the first passenger is drunk. The drunk passenger randomly goes to another passenger's seat and then sits there. You may assume the following.

  1. The drunk passenger never takes their own seat.
  2. The probability of any other seat taken by the drunk passenger is uniform.

Luckily, all the other passengers are not drunk. However, they don't want to move any passenger from a taken seat. If a passenger's seat has been taken by another passenger when boarding, the passenger would randomly take a vacant seat with equal probability. Otherwise, the passengers just take their own seats.

Please write a program to compute the probability that your seat is taken by another passenger.

Input:

The input contains only one positive integer $$$n$$$.

  • $$$1<n\le 300$$$

Output:

Output the probability that your seat is taken by another passenger. It is acceptable if the difference between your output and the answer is less than $$$10^{-6}$$$.

Sample Input:

2

Sample Output:

1

Sample Input:

3

Sample Output:

0.75

Sample Input:

4

Sample Output:

0.666666666666666666666666666666666666666666666666666666666666666666666666667

Note:

The problem statement is a fiction.

Info

CodeForces Gym

Provider CodeForces Gym

Origin 2021 ICPC Asia Taiwan Online Programming Contest

Code GYM103373D

Tags

Submitted 0

Passed 0

AC Rate 0%

Date 10/31/2021 14:46:02

Related

Nothing Yet