#P2397. yyy loves Maths VI (mode) / 摩尔投票
yyy loves Maths VI (mode) / 摩尔投票
Description
There are positive integers . He asks redbag to find the mode. He also specifically states that this mode occurs more than half of the elements.
Input Format
The first line contains an integer , the number of values.
The second line contains positive integers .
Output Format
Output one line with a single integer, the mode.
5
2 3 3 3 3
3
Hint
Constraints
For of the testdata, , .
Some may want to take the easy way out, but the memory is not enough.
//kkksc03 whispers: Just output any number; you have a 1/2 chance. But this is "Le Duo Sai", whether it is worth it is up to you. So you had better think about the proper solution.
Translated by ChatGPT 5
京公网安备 11011102002149号