AmazonOA #145
Transform to Encrypted Number
Estimated EasyJudge-ready
Topics (AI-labelled)SimulationBits & Math
In each round, add every two adjacent numbers and keep only the ones digit, so the array length decreases by 1. Repeat until exactly two digits remain, and output them in order as a two-character string, keeping a leading 0.
Input
The first line contains n (2..5000), and the second line contains n digits in 0..9.
Output
Output exactly two digit characters; a leading 0 must be kept.
Example 1
Input:
4
4 5 6 7
Output:
04
Example 2
Input:
4
1 2 3 4
Output:
82
Example 3
Input:
2
0 0
Output:
00
Example notes
Example 1: 4567→913→04, so output 04 rather than 4. Example 2: 1234→357→82. Example 3: the original two digits are 00, so no operation is needed; output 00.
Editorial
Loading solution…