cswork / OA打开练习工作台

AmazonOA #10

Pascal Triangle Encryption

估计困难可在线判题

考点(AI 标注)位运算

In each round, take the sum of every two adjacent digits modulo 10 to get a new array whose length is 1 less. Repeat until 2 digits remain, then output the string formed by those two digits, keeping leading zeros.

输入格式

The first line contains n (2..100000); the second line contains n digits (0..9).

输出格式

Output one integer, the answer required by the problem.

样例 1

输入:

4
4 5 6 7

输出:

04

样例 2

输入:

2
0 0

输出:

00

样例 3

输入:

3
9 1 9

输出:

00

样例说明

Example 1: [4,5,6,7] first becomes [9,1,3], then [0,4], so the output is 04; the leading zero must not be dropped. Example 2: two digits already remain, so output 00 directly. Example 3: the adjacent sums 9+1 and 1+9 are both 0 modulo 10, so output 00.