Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. #include<string>
  5. using namespace std;
  6. int main() {
  7. int n;
  8. cin >> n;
  9. vector<int> a(n, 0);
  10. for (int i = 0; i < n; i++) {
  11. cin >> a.at(i);
  12. }
  13. int col = 1;
  14. sort(a.begin(), a.end());
  15. for (int i = 1; i < n; i++) {
  16. if (a.at(i) != a.at(i - 1))col++;
  17. }
  18. cout << col << endl;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement