第k小数
题目描述
给你一个长度为n的序列,求序列中第k小数的多少。
n <= 2e6
- 快排求 K大值
- std::nth_element
Q = read();
while(Q--) {
n = read(), K = read();
for(int i=0; i<n; i++) a[i] = read();
std::nth_element(a, a+K-1, a+n);
printf("%d\n", a[K-1]);
}
题目描述
给你一个长度为n的序列,求序列中第k小数的多少。
n <= 2e6
Q = read();
while(Q--) {
n = read(), K = read();
for(int i=0; i<n; i++) a[i] = read();
std::nth_element(a, a+K-1, a+n);
printf("%d\n", a[K-1]);
}
相关推荐
用微笑面对困难:确实比较烂,可以这么修改:加上大学的qs排名,然后大学简介要写一些,然后硕士大学加大加粗,科研经历第一句话都写上在复旦大学时,主要负责xxxx,简历左上角把学校logo写上,建议用复旦大学的简历模板