fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(NULL);
  10. cout.tie(0);
  11.  
  12. vector<int> ted(8);
  13.  
  14. for(int i = 0; i < 8; i++){
  15. cin >> ted[i];
  16. }
  17.  
  18. sort(ted.begin() + 2, ted.begin() + 6);
  19.  
  20. for(int i = 0; i < 8; i++){
  21. cout << ted[i] << " ";
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5320KB
stdin
9 2 6 4 8 4 3 2 
stdout
9 2 4 4 6 8 3 2