AmazonOA #90
findNumber — Pascal Encryption
Estimated EasyJudge-ready
Topics (AI-labelled)SimulationBits & Math
Repeatedly build a new array from the sums of adjacent pairs modulo 10 until only two elements remain, then output them as a two-character string; leading 0s must not be dropped.
Input
The first line contains n (2..5000), and the second line contains n digits from 0..9.
Output
Output a string of exactly two digits, keeping leading 0s.
Example 1
Input:
4
4 5 6 7
Output:
04
Example 2
Input:
2
0 0
Output:
00
Example 3
Input:
3
9 9 9
Output:
88
Example notes
Example 1: 4 5 6 7→9 1 3→0 4, output 04. Example 2: already two digits, output 00 as is. Example 3: 9 9 9→8 8, output 88.
Editorial
Loading solution…