#C14794. Majority Element Finder
Majority Element Finder
Majority Element Finder
This problem requires you to identify the majority element in a list of integers using the Boyer-Moore Voting Algorithm. The majority element is defined as an element that appears more than \(\lfloor \frac{n}{2} \rfloor\) times, where \(n\) is the number of elements in the list.
If no majority element exists, you should output "None".
For example, if the list is [1, 2, 3, 1, 1], the majority element is 1, because it appears 3 times out of 5, which is more than \(\lfloor5/2\rfloor = 2\).
inputFormat
The input is provided via standard input (stdin) in the following format:
n num1 num2 num3 ... numN
Here, n
is a non-negative integer denoting the number of elements. If n = 0
, there is no second line.
outputFormat
Output the majority element if it exists; otherwise, output "None". The output must be produced via standard output (stdout).
## sample5
1 2 3 1 1
1