Submit | All submissions | Best solutions | Back to list |
CARDSMIS - Find the missing card |
Little Johny loves playing cards. He had a deck containing N cards (all cards are numbered from 1 to N). He gave the deck of cards to his sister Derp. Derp being very careless lost a card and gave the deck back to Johny thinking it was very hard for Johny to find the card lost by her. True to Derp's assumption Johny couldn't find the missing card. Your task is to help Johny to find the missing card.
Input
The first line will contain an integer T (number of test cases <=10)
Each test case begins with an integer N (2 <= N <= 10^6)
The next line will contain N-1 space separated distinct integers in random order(all integers are in the range (1, N) inclusively.)
Output
For each test case output the missing card in a new line.
Example
Input: 5
7
4 5 2 1 7 6
5
1 2 3 4
8
8 7 6 5 4 3 1
6
1 3 5 2 4
3
2 1
Output:
3
5
2
6
3
Added by: | Ranjith Mudalaiyar |
Date: | 2012-05-24 |
Time limit: | 1.713s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own problem |