1002.cpp 407 B

123456789101112131415161718192021
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <map>
  4. using namespace std;
  5. int main() {
  6. map<int, int> maps;
  7. int n;
  8. cin >> n;
  9. for (int i = 0; i < n; ++i) {
  10. int tmp;
  11. scanf("%d", &tmp);
  12. ++maps[tmp];
  13. }
  14. for (auto it = maps.rbegin(); it != maps.rend(); ++it) {
  15. cout << it->first << ":" << it->second << endl;
  16. }
  17. cout << maps.size();
  18. return 0;
  19. }