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,,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 N1 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 1M100, 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,,N}. Any of the numbers (including 1 or N) can be taken.

Sample Input

Copy
2
1
2
2
2
3
2
1
3

Sample Output

Copy
3
1
2

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments


  • 7
    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?