解法:
希尔增量选定n/2,
#include<iostream>
#include<vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> vec(n);
for (int i = 0; i < n; i++) cin >> vec[i];
int d = n / 2;
for (int i = 0; i < d; i++) {
if (vec[i] > vec[i + d])
swap(vec[i], vec[i + d]);
}
for (int x : vec) cout << x << " ";
return 0;
}