fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int nmax = 40;
  5.  
  6. int main() {
  7. int N, afk[nmax], count;
  8.  
  9. int dn[40] = {6, 1, 2, 1, 5, 3, 1, 0, 3, 1, 2, 3, 6, 2, 1, 1, 5, 5, 1, 5, 0, 1, 3, 0, 0, 1, 0, 2, 1, 0, 0, 3, 1, 5, 2, 1, 4, 1, 0, 3};
  10. N = 40;
  11. for(int i=0; i<N; i++){
  12. afk[i] = -1;
  13. }
  14.  
  15. for(int i=0; i<N; i++){
  16. count = 1;
  17. for(int j=i+1; j<N; j++){
  18.  
  19. if(dn[i]==dn[j]){
  20. count++;
  21.  
  22. afk[j] = 0;
  23. }
  24. }
  25.  
  26. if(afk[i] != 0) afk[i] = count;
  27. }
  28.  
  29.  
  30. for(int i=0;i<N;i++){
  31. if(afk[i] != 0){
  32. cout << endl << dn[i] << " | " << afk[i];
  33. }
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 5684KB
stdin
Standard input is empty
stdout
6 | 2
1 | 13
2 | 5
5 | 5
3 | 6
0 | 8
4 | 1