cses

solution to cses exercise problems
git clone git://git.superpozycja.net/cses
Log | Files | Refs | README

missing_number.cpp (274B)


      1 #include <bits/stdc++.h>
      2 
      3 using namespace std;
      4 
      5 void solve()
      6 {
      7 	int n;
      8 	cin >> n;
      9 	int a[n] = {0};
     10 	for (int i = 0; i < n-1; i++) {
     11 		int t;
     12 		cin >> t;
     13 		a[t-1] = 1;
     14 	}
     15 	for (int i = 0; i < n; i++) {
     16 		if (a[i] == 0)
     17 			cout << i+1 << "\n";
     18 	}
     19 
     20 }
     21 
     22 int main()
     23 {
     24 	solve();
     25 }