Advertisement
Josif_tepe

Untitled

Oct 7th, 2022
1,275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.    
  10.     int niza[n];
  11.     int elementi[n + 1];
  12.    
  13.     for(int i = 1; i <= n; i++) {
  14.         elementi[i] = 0;
  15.     }
  16.    
  17.     for(int i = 0; i < n - 1; i++) {
  18.         cin >> niza[i];
  19.         elementi[niza[i]] = 1;
  20.     }
  21.     for(int i = 1; i <= n; i++) {
  22.         if(elementi[i] == 0) {
  23.             cout << i << endl;
  24.         }
  25.     }
  26.    
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement