아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Drunk Passenger

시간 제한1초메모리 제한1024 MB

요약
첫 승객이 술에 취해 다른 승객의 좌석에 무작위로 앉고, 이후 승객은 자기 좌석이 차 있으면 빈 좌석을 무작위로 고를 때 마지막 승객의 좌석이 점유될 확률을 구한다.
난이도

보통10점 중 4점

유형
확률, 수학
정답자
아직 제출이 없습니다

문제

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.

입력

The input contains only one positive integer n.

출력

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.'

제한

  • 1 < n ≤ 300

힌트

The problem statement is a fiction.

예제3

  1. 예제 1

    입력
    2
    
    예상 출력
    1
    
  2. 예제 2

    입력
    3
    
    예상 출력
    0.75
    
  3. 예제 3

    입력
    4
    
    예상 출력
    0.6666666666666666666666667