fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, v[100000], fr[501];
  6. cin >> n;
  7. for (int i = 1; i <= 500; ++i) {
  8. fr[i] = 0;
  9. }
  10. for (int i = 1; i <= n; ++i) {
  11. cin >> v[i];
  12. ++fr[v[i]];
  13. }
  14. for (int i = 0; i <= 500; ++i) {
  15. for (int j = 1; j <= fr[i]; ++j) {
  16. cout << i << ' ';
  17. }
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5280KB
stdin
10
15 47 98 23 145 74 89 32 1 74
stdout
1 15 23 32 47 74 74 89 98 145