DWITE Online Computer Programming Contest

October 2009

Problem 3

That Missing Number

You have a continuous sequence of unique numbers, 1 to N, that you like very much, but your little sister always steals one (and only one), and randomly re-arranges the rest in an attempt to hide the crime. Given N-1 numbers, in a random order, find out which number was taken.

The input file **DATA3.txt** will contain 5 sets of input. The first line will be an integer 1 <= M <= 100, the number of items remaining. Followed by M lines of unique integers, from at least 1 to at most M+1.

The output file **OUT3.txt** will contain 5 lines, each an integer from the missing set.

*Note: the original sorted sequence is {1, 2, 3,..., N-1, N}. Any of the numbers (including 1 or N) can be taken.*

Sample Input (first 3 of 5 shown):

2 1 2 2 2 3 2 1 3

Sample Output (first 3 of 5 shown):

3 1 2