Problem

2/3

Based on the exam 2019

Problem

Given an array containing 2018 positive integers not exceeding 10,000. You need to find and display the maximum of those elements of this array whose decimal and hexadecimal representations end with the same character. If there are no such numbers in the array, the answer is considered to be zero.
For example, for an array of four elements equal to 80, 91, 162 and 250,  the answer should be 162. In hexadecimal, these numbers are written as 50, 5B, A2, and FA. The last character in decimal and hexadecimal notation is the same for the first and third numbers, the larger of them – the third is 162.
The source data is declared as shown. It is forbidden to use variables not described below, but it is allowed not to use part of those described.