Logo
(追記) (追記ここまで)

19458번 - Expected LCP 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 256 MB47281875.000%

문제

Consider a sequence $s_1,ドル $s_2,ドル $\ldots,ドル $s_n$ of $n$ infinite binary strings (that is, consisting only of zeros and ones), where each character of each string is generated uniformly at random independently from others. Denote $$f(s_1, s_2, \ldots, s_n) = \max_{1 \le i < j \le n} LCP(s_i, s_j)\text{,}$$ where $LCP$ is the maximum common prefix of two strings. Compute the expected value of $f(s_1, s_2, \ldots, s_n)$.

입력

The only line of the input contains one integer $n$ (2ドル \le n \le 10^4$).

출력

Let the answer in the form of an irreducible fraction be $P / Q$. Then output $P \cdot Q^{-1} \bmod (10^9 + 7)$. It is guaranteed that $Q \bmod (10^9 + 7) \neq 0$.

제한

예제 입력 1

2

예제 출력 1

1

예제 입력 2

3

예제 출력 2

333333338

힌트

Note that the expected value is always finite, that is, $\mathtt{E}f(s_1, \ldots, s_n) < \infty$.

In the second sample the answer is $\frac{7}{3}$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 3: Moscow IPT Contest E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /