CF637A Voting for Photos
题目描述
给定一个数组,找出出现最多的数,若有多个,输出最后一次出现时最靠前的数。
输入格式
两行。
第一行,一个自然数n(1
输出格式
一行,出现最多的数中,最后一次出现时最靠前的数。
说明/提示
In the first test sample the photo with id 1 got two likes (first and fifth), photo with id 2 got two likes (third and fourth), and photo with id 3 got one like (second).
Thus, the winner is the photo with identifier 2, as it got:
- more likes than the photo with id 3;
- as many likes as the photo with id 1, but the photo with the identifier 2 got its second like earlier.