#C12213. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given a list of integers that represents a sequence of consecutive numbers with exactly one number missing. The numbers may be provided in any order. Your task is to find and print the missing number.
Recall that the sum of an arithmetic sequence can be computed with the formula:
$$ S = \frac{(a+b)\times (b - a + 1)}{2} $$
where a is the minimum value and b is the maximum value of the sequence. The missing number can be found by subtracting the sum of the given numbers from the expected total sum of the complete sequence.
inputFormat
The input is read from standard input (stdin) as a single line of space-separated integers representing the sequence with one missing number.
outputFormat
Output the missing number to standard output (stdout) as an integer.
## sample1 2 3 5
4