文章

13

粉丝

43

获赞

4

访问

3.2k

头像
集合中的相同元素 题解:
Kohi VIP
P5105
发布于2024年3月7日 16:23
阅读数 222

#include <bits/stdc++.h>
using namespace std;

int quickSort(int s[],int from, int to){
    int l = from, r = to;
    if(l >= r)
        return -1;
    int pivot = s[from];
    while(l < r){
        while(l < r && s[r] >= pivot)
            r--;
        s[l] = s[r];
        while(l < r && s[l] <= pivot)
            l++;
        s[r] = s[l];
    }
    s[l] = pivot;
    quickSort(s, from, l - 1);
    quickSort(s, l + 1, to);
    return l;
}

int main(){
    int n;
    scanf("%d", &n);
    int *s1 = (int *)malloc(n * sizeof(int));
    int *s2 = (int *)malloc(n * sizeof(int));
    for(int i = 0; i < n; i++){
...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发