Advertisement
Guest User

b.cpp

a guest
Apr 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. #include <list>
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n;
  9.     cin >> n;
  10.     int*  mae = new int[n];
  11.     int  maie_cnt = 0;
  12.     for (int tshirt, i = 0; i < n; i++) {
  13.         cin >> tshirt;
  14.         if (i != 0) cout << ' ';
  15.         bool found = false;
  16.         for (int j = 0; j < maie_cnt; j++) {
  17.             if (mae[j] == tshirt) {
  18.                 found = true;
  19.                 break;
  20.             }
  21.         }
  22.         if (!found) {
  23.             mae[mae_cnt] = tshirt;
  24.             mae_cnt++;
  25.         }
  26.         cout << (int)(!found);
  27.     }
  28.     cout << endl;
  29.     delete[] mae;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement