fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, x;
  6. int k[6] = {};
  7.  
  8. cin >> n;
  9.  
  10. for (int i = 0; i < n; i++) {
  11. cin >> x;
  12. if (x >= 1 && x <= 6)
  13. k[x - 1]++;
  14. }
  15.  
  16. for (int i = 0; i < 6; i++) {
  17. cout << k[i] << " ";
  18. }
  19.  
  20. return 0;
  21. }
  22.  
  23.  
Success #stdin #stdout 0.01s 5288KB
stdin
10
1 2 3 4 5 6 6 6 6 6
stdout
1 1 1 1 1 5