#P6340. [COCI 2007/2008 #2] KEMIJA

[COCI 2007/2008 #2] KEMIJA

Problem Description

Please construct a ring made up of nn numbers, such that for every number in the ring, the result of adding it with its two adjacent numbers is equal to the given target ring.

Input Format

The first line contains an integer nn.

The next nn lines each contain an integer, representing the given target ring.

Output Format

Output nn lines in total, each containing one integer, describing the ring you construct.

There may be multiple valid constructions. This problem uses SPJ.

3
5
5
5
2
1
2
4
20
15
17
14
5
8
2
7
5
7
8
9
10
11
4
1
3
5
2

Hint

Constraints

  • For 70%70\% of the testdata, it is guaranteed that n<100n < 100.
  • For 100%100\% of the testdata, it is guaranteed that 3n1043 \le n \le 10^4, and the numbers in the given target ring do not exceed 10910^9.

Notes

Translated from COCI2007-2008 CONTEST #2 T5 KEMIJA

Translated by ChatGPT 5