Naohiro had N+1 consecutive integers, one of each, but he lost one of them.
The remaining N integers are given in arbitrary order as A1 ,…,AN. Find the lost integer.
The given input guarantees that the lost integer is uniquely determined.
给定一个长度为 n 的**乱序**序列 a。但是,这个序列中有一个数字消失了。如果加上这个数字,那么序列就是一段连续的数字。
请找出这个消失的数字。
The input is given from Standard Input in the following format:
N
A1 A2… AN
Print the answer.
3 2 3 5
4
8 3 1 4 5 9 2 6 8
7
16 152 153 154 147 148 149 158 159 160 155 156 157 144 145 146 150
151
2≤N≤100
1≤Ai≤1000
All input values are integers.
The lost integer is uniquely determined.
时间限制 | 1 秒 |
内存限制 | 128 MB |