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

19081번 - In The End 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB111100.000%

문제

There is a board which is infinite in one direction. The board consists of $n$ rows and an infinite number of columns: there is the first (leftmost) column but no last column. Each column contains exactly one cell with a cake: the probability that the cake is in the $i$-th row is $p_i,ドル and all $p_i$ sum up to 1ドル$. Positions of cakes in different columns are independent.

You control a robot which starts in some cell of the first column. On each step, if the robot is at cell $(x, y)$ (which means $x$-th row and $y$-th column), the robot can move to $(x, y + 1),ドル $(x - 1, y + 1)$ or $(x + 1, y + 1),ドル if such cell exists. Whenever the robot visits a cell with a cake in it, that cake is collected.

The robot wants to collect as many cakes as possible. Given the probabilities $p_i,ドル find the average number of cakes the robot will collect on each step.

Assume that the order of events is as follows. First, all cakes are placed on the board according to the given probabilities. Then, the configuration of the board is given to the robot. After that, the robot chooses a starting cell and a movement plan in order to maximize the average number of collected cakes.

Formally, consider the sequence of boards of sizes $n \times m$ for $m = 1, 2, \ldots$. For each such finite board, the robot receives the configuration and then chooses an optimal route. Let $f (m)$ be the expected average number of cakes collected on an $n \times m$ board. Your task is to calculate the limit $$\lim\limits_{m \rightarrow \infty} \frac{f(m)}{m}\text{.}$$

입력

The first line contains an integer $n$ (1ドル \le n \le 6$), the number of rows.

The next line contains $n$ real numbers $p_i$ (0ドル \le p_i \le 1$) given with at most one digit after the decimal point: the probability distribution.

출력

It can be proven that the answer to the problem can be expressed as a fraction $\frac{P}{Q}$ for some positive integers $P$ and $Q$. Find such $P$ and $Q,ドル and print the number $(P \cdot Q^{-1}) \bmod (10^9 + 7)$.

제한

예제 입력 1

2
0.5 0.5

예제 출력 1

1

예제 입력 2

3
0.3 0.3 0.4

예제 출력 2

804545461

예제 입력 3

4
0.2 0.3 0.2 0.3

예제 출력 3

84928504

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 5: Moscow IPT Contest E번

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

출처

대학교 대회

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

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