fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, s[1000], aux;
  6. cin >> n;
  7. for (int i = 1; i <= n; i++) {
  8. cin >> s[i];
  9. }
  10. for (int i = 1; i < n; i++) {
  11. for (int j = i + 1; j <= n; j++) {
  12. if (s[i] % 100 == s[j] % 100) {
  13. if (s[i] > s[j]) {
  14. aux = s[i];
  15. s[i] = s[j];
  16. s[j] = aux;
  17. }
  18. } else if (s[i] % 100 > s[j] % 100) {
  19. aux = s[i];
  20. s[i] = s[j];
  21. s[j] = aux;
  22. }
  23. }
  24. }
  25. for (int i = 1; i <= n; i++) {
  26. cout << s[i] << " ";
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5284KB
stdin
2
223 223

stdout
223 223