Advertisement
Guest User

Untitled

a guest
May 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int solution(vector<int> &B) {
  6. B.push_back(1);
  7. B.push_back(3);
  8. B.push_back(6);
  9. B.push_back(4);
  10. B.push_back(1);
  11. int max=0,min=0,index;
  12.  
  13. for(int i=0;i<B.size();i++)
  14. {
  15. if(B[i] > max) max = B[i];
  16. }
  17. int tab[max+1];
  18. for(int i=1;i<max+1;i++)
  19. {
  20. tab[i] = 0;
  21. }
  22. for(int j=1;j<max+1;j++)
  23. cout << tab[j];
  24. for(int k=1;k<max+1;k++)
  25. {
  26. index = B[k];
  27. tab[index]++;
  28. }
  29. int temp=1;
  30. while(tab[temp]!=0)
  31. {
  32. cout << tab[temp];
  33. temp++;
  34. }
  35.  
  36. }
  37. int main() {
  38. vector<int> B;
  39. solution(B);
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement