AtCoder Beginner Contest 194
D
Journey
AtCoder
⌀ 1078
原题
← CE →
翻译中…

Problem Statement

翻译中…

We have a graph with $N$ vertices called Vertex $1$ through $N$. Takahashi is standing on Vertex $1$. The graph has no edges now. Takahashi will repeatedly do the following operation:

翻译中…
  1. Choose one of the $N$ vertices (including the one on which Takahashi is standing now). Every vertex is chosen with probability $\frac{1}{N}$, independently from previous operations.
  2. Add an edge between the vertex on which Takahashi is standing now and the chosen vertex, and go to the chosen vertex.
翻译中…

Find the expected value of the number of times he does the operation until the graph becomes connected.

翻译中…

Constraints

翻译中…
  • $2 \le N \le 10^5$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer. Your answer will be considered correct when its absolute or relative error from our answer is at most $10^{-6}$.

翻译中…

样例

Input #1
2
Output #1
2.00000000000
The graph becomes connected when the operation chooses Vertex $2$ for the first time. By considering the case Vertex $2$ is chosen for the first time in the $i$-th operation for each $i$, the answer is $\sum_{i = 1}^{\infty} (i \times (\frac{1}{2})^i) = 2$.
Input #2
3
Output #2
4.50000000000
题目信息
题号
abc194_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。