#P2719. 搞笑世界杯

搞笑世界杯

Description

After the World Cup group stage ended, world powerhouses such as France and Argentina were eliminated, which was heartbreaking. So someone organized a funny World Cup, regrouping these eliminated strong teams to compete alongside the World Cup. You and your friend gladly went to buy tickets. However, the ticket sale method for the funny World Cup was also special: they prepared only two kinds of tickets.

  • Type A — free ticket.
  • Type B — double-price ticket.

At purchase time, a staff member decides by flipping a coin: heads buys a type A ticket, tails buys a type B ticket. The organizer always prepared the same number of type A and type B tickets. You and your friend are lucky enough to be in the last two spots for a spectacular match.

The staff starts selling tickets via coin toss. But even more fortunately, when the staff reaches you two, he finds there is no need to flip the coin anymore, because the last two remaining tickets are both free.

In your delight, you want to calculate the probability that the last two people in line receive the same kind of ticket (including both getting type A or both getting type B). Assume the staff prepared 2n2n tickets, consisting of nn type A tickets and nn type B tickets, and each person in line must and can only buy exactly one ticket (regardless of whether the coin flip indicates buying A or B).

Input Format

The input contains a single integer on one line, denoting 2n2n.

Output Format

Output a single floating-point number on one line: the probability that the last two people receive the same kind of ticket, accurate to 4 decimal places.

256
0.9500

Hint

Constraints

For all test points, it is guaranteed that 1n12501 \leq n \leq 1250.

Translated by ChatGPT 5