問題一覧 > 通常問題

No.1993 Horse Racing

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 178
作問者 : MasKoaTS / テスター : 👑 qand 👑 potato167
お気に入りにしたユーザー ProblemId : 7918 / 自分の提出
問題文最終更新日: 2024-11-28 20:09:48
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 350 (順位表) の他の問題:

Problem Statement

At the ranch run by Core-san, $N$ horses numbered $1, 2, \dots, N$ are raised.
Core-san decided to have these $N$ horses race according to the following rules.

  • All horses start running simultaneously from a common starting point and race to a common finish point.
    The race course is a straight line, and the length from the starting point to the finish point is $1000$ meters.

When this race was held, the following held for $i = 1, 2, \dots, N-1$.

  • When horse $i$ finished, horse $(i + 1)$ was running $A_{i}$ meters behind horse $i$.

When horse $1$ finished, how many meters behind horse $1$ was horse $N$ running?

Here, assume that each horse always runs at a constant speed.

Constraints

  • $2 \leq N \leq 100$

  • $0 \leq A_{i} \leq 10$ $(1 \leq i \leq N-1)$

  • All inputs are integers.

Input

The input is given in the following format.

$N$
$A_{1}$ $A_{2}$ $\cdots$ $A_{N-1}$
  • The $1$st line contains $N$.

  • The $2$nd line contains $A_{1}, A_{2}, \dots, A_{N-1}$ in this order, separated by single spaces.

Output

Print the answer on $1$ line, followed by a newline.

The output is judged as correct if its absolute or relative error from the expected answer is at most $10^{−6}$.

Sample

Sample 1
Input
3
10 10
Output
19.9

When horse $1$ has finished running $1000$ meters, horse $2$ has run $990$ meters, so
we can see that the speed of horse $2$ is $990 / 1000$ times that of horse $1$.

Similarly, the speed of horse $3$ is $990 / 1000$ times that of horse $2$, so
when horse $1$ has finished running $1000$ meters, horse $3$ is running

$\displaystyle 1000 - 1000 \times \dfrac{990}{1000} \times \dfrac{990}{1000} = 19.9$

meters behind horse $1$.

Sample 2
Input
11
1 2 3 4 5 6 7 8 9 10
Output
53.6979931256464667570490112

Even if the output value does not exactly match the expected answer, it is judged as correct if its absolute or relative error from the expected answer is at most $10^{−6}$.

When using std::cout in C++, be careful about the number of digits displayed in the output value.

Sample 3
Input
8
0 0 0 0 0 0 0
Output
0

All $8$ horses run at the same speed.

Sample 4
Input
2
10
Output
10

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。