DWITE '09 R1 #3 - That Missing Number

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, October 2009, Problem 3

You have a continuous sequence of unique numbers, 1, 2, \dots, 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 will contain 5 sets of input. The first line will be an integer 1 \le M \le 100, the number of items remaining. Followed by M lines of unique integers, from at least 1 to at most M+1.

The output will contain 5 lines, each an integer from the missing set.

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

Sample Input

2
1
2
2
2
3
2
1
3

Sample Output

3
1
2

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments


  • 6
    Snoogy  commented on Dec. 23, 2020, 7:50 p.m.

    The question states there will be 5 sets of input, but in the example there are only 3?