#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pa for(int i = 0; i < n; ++i) cout << a[i] << " ";
#define pi atan(1) * 4
#define ctn continue
#define ms(input,value) memset(input,value,sizeof(input))
#define all(input) input.begin(),input.end()
#define FOR(i, a, b, x) for (int i = (a); i < (b); i += x)
#define FORd(i, a, b, x) for (int i = (a) - 1; i >= (b); i -= x)
#define pb push_back
#define pf push_front
using namespace std;
const int MAX = 1e7;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9 + 1;
inline int readInt(){char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();int n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;}
inline int readll(){char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();ll n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;}
inline ll gcd(ll a,ll b){ll r;while(b){r=b;b=a%b;a=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int n, k;
ll a[MAX];
void quickSort(ll left, ll right) {
int i = left, j = right;
int pivot = a[(left + right) / 2];
while(i <= j) {
while(a[i] < pivot) ++i;
while(a[j] > pivot) --j;
if(i <= j) {
swap(a[i],a[j]);
++i;
--j;
}
}
if(left < j) quickSort(left, j);
if(i < right) quickSort(i, right);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
n = readInt();
k = readInt();
FOR(i, 0, n, 1) a[i] = readll();
quickSort(0, n - 1);
//FOR(i, 0, n, 1) cout << a[i] << " ";
cout << a[n - k];
}
#include <vector>
#include <iostream>
#include <algorithm>
#define all(x) (x).begin(), (x).end()
using namespace std;
vector<int> a;int n, k;inline int readInt() {char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();int n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
n = readInt();
k = readInt();
for (int i = 0; i < n; ++i) a.push_back(readInt());
sort(all(a),greater<int>());
cout << a[k - 1];
}
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 8 - Năm thứ ba ở cấp trung học cơ sở, học tập bắt đầu nặng dần, sang năm lại là năm cuối cấp áp lực lớn dần nhưng các em vẫn phải chú ý sức khỏe nhé!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK