Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int niza[n];
- for (int i = 0; i < n - 1; i++)
- {
- cin >> niza[i];
- }
- if (n == 2)
- {
- if(niza[0] == 1) {
- cout << 2 << endl;
- }
- else {
- cout << 1 << endl;
- }
- return 0;
- }
- sort (niza, niza + n - 1);
- for(int i = 0; i < n - 2; i++)
- {
- if(niza[i + 1] - niza[i] == 1)
- {
- }
- else {cout << niza[i + 1] - 1 << endl;
- return 0;
- }
- }
- cout << n << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement