問題一覧 > 通常問題

No.970 Sequence Conversion Machine

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 311
作問者 : 沙耶花 / テスター : shibh308
お気に入りにしたユーザー ProblemId : 3633 / 自分の提出
問題文最終更新日: 2020-05-07 19:59:42
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 234 (順位表) の他の問題:

Problem Statement

When a sequence $a$ of $n$ elements is put into the input slot of a sequence conversion machine, a sequence $b$ of $n$ elements comes out of the output slot.
Here, the value of the $i$-th element $b_i$ of $b$ is equal to the arithmetic mean of the $n-1$ elements obtained by removing the $i$-th element $a_i$ from $a$.
For example, if the sequence $a=\{3,5,7\}$ is put in, the values of the output sequence $b$ are
\[b_1=\frac{5+7}{2}=6,\ b_2=\frac{3+7}{2}=5,\ b_3=\frac{3+5}{2}=4\] .

One day, you noticed that there is an integer sequence $y_1,...,y_N$ of $N$ elements at the output slot of the sequence conversion machine.
Apparently, your past self put in some integer sequence $x_1,...,x_N$ and then forgot about it.

You became curious about what integer sequence was put in to produce $y$, and decided to find it.

Input

$N$
$y_1 \ y_2 \  ... \ y_N$

  • $2 \le N \le 10^5$
  • $-1000 \le y_i \le 1000 $
  • All inputs are integers.

Output

Output the values of the desired integer sequence $x$ on a single line, separated by spaces.
It can be shown that a unique answer exists for any input satisfying the constraints.
Print a newline at the end.

Sample

Sample 1
Input
3
6 5 4
Output
3 5 7

This corresponds to the sequences $a,b$ given as the example at the beginning of the problem statement.

Sample 2
Input
2
-100 100
Output
100 -100

Sample 3
Input
6
0 0 0 0 0 0
Output
0 0 0 0 0 0

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