求解答!!!
代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n+1];
for(int i=1; i<=n; i++){
cin >> arr[i];
}
int m;
cin >> m;
int search[m][3];
for(int i=0; i<m; i++){
cin >> search[i][0] >> search[i][1] >> search[i][2];
}
for(int i=0; i<m; i++){
int low = search[i][0];
int high = search[i][1];
int find = search[i][2];
int temp = high - low + 1;
int buf[temp], k=0;
for(int j=low; j<=high; j++){
buf[k] = arr[j];
k++;
}
sort(buf, buf+temp);
cout << buf[temp-find];
if(i<m-1){
cout << endl;
}
}
return 0;
}