偷懒大法
2024-01-29 15:23:48
发布于:广东
50阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int m;
int* o;
int sq(int *nums,int n){
if(n<=1)return 0;
sq(nums,n/2+n%2);
sq(nums+n/2+n%2,n/2);
sort(nums,nums+n);
for(int i = 0;i<m;i++){
cout << *(o+i)<<" ";
}
cout<<"\n";
}
int main(){
int n;
cin >> n;
m = n;
int nums[n];
for(int i = 0;i<n;i++)cin>>nums[i];
int* p = nums;
o = p;
sq(p,n);
}
这里空空如也
有帮助,赞一个