fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 1000;
  5.  
  6. int main() {
  7. int n, fr[MAX_SIZE + 1] = {0};
  8.  
  9. cin >> n;
  10. int m = (n+(n - 1));
  11. for(int i = 1; i <= n; ++i){
  12. int currentElement;
  13. cin >> currentElement;
  14. ++fr[currentElement];
  15. }
  16.  
  17. for(int i = 1; i <= MAX_SIZE; ++i){
  18. if(fr[i] == 1){
  19. cout << i << " ";
  20.  
  21.  
  22. }
  23. //cout << fr[i] << " ";
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 5284KB
stdin
10 
32 34 89 -67 45 21 34 5 9 7
34 32 45 89 34 21 5 7 9

5 3
1 2 3 6 5
2 1
stdout
5 7 9 21 32 45 89