Code for USACO practice problems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
393 B

#include <iostream>
using namespace std;
long findMissingNo(long arr[], long len) {
long temp;
temp = ((len) * (len + 1)) / 2;
for (long i = 0; i < len - 1; i++)
temp -= arr[i];
return temp;
}
int main() {
long n;
cin >> n;
long arr[n];
for (long i = 0; i < n - 1; i++) {
cin >> arr[i];
}
long missingNo = findMissingNo(arr, n);
cout << missingNo;
return 0;
}