Acwing-----基础课复习
标签:str cout main com name problem 算法 return scanf
第一讲:基础算法
785. 快速排序
- 链接:https://www.acwing.com/problem/content/787/
#include
using namespace std;
const int N = 1000010;
int q[N];
void quick_sort(int q[], int l, int r) {
if (l >= r) return ;
int x = q[(l + r) / 2], i = l - 1, j = r + 1;
while (i x);
if (i > n;
for (int i = 0; i > q[i];
quick_sort(q, 0, n - 1);
for (int i = 0; i
786. 第k个数
- 链接:https://www.acwing.com/problem/content/788/
#include
using namespace std;
const int N = 100010;
int n, k, q[N];
int quick_sort(int l, int r, int k) {
if (l >= r) return q[l];
int i = l - 1, j = r + 1, x = q[l + r >> 1];
while (i x);
if (i
Acwing-----基础课复习
标签:str cout main com name problem 算法 return scanf
原文地址:https://www.cnblogs.com/clown9804/p/12628754.html
评论