#C13768. Finding the Middle Binary Number
Finding the Middle Binary Number
Finding the Middle Binary Number
You are given a list of binary numbers represented as strings. Your task is to first sort these binary numbers in ascending order based on their integer values. After sorting, you must output the middle number in the list. In the case of an even-length list, return the lower of the two middle numbers.
For example, consider the list ["101", "111", "001", "010"]. When converted to integers these represent [5, 7, 1, 2]. After sorting, we obtain ["001", "010", "101", "111"]. Since there is an even number of elements, the two middle numbers are "010" and "101"; hence the correct output is "010".
Make sure your solution reads from standard input and writes to standard output.
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains a single integer n representing the number of binary numbers. The second line contains n space-separated binary numbers.
For example:
4 101 111 001 010
outputFormat
The output should be a single binary number (as a string) printed to standard output (stdout), which is the middle element after sorting the input list as described.
## sample4
101 111 001 010
010