114514

天下为公 · 发布于 2024-06-08 · 浏览 673 回复 0
#include<bits/stdc++.h>
using namespace std; struct student {

int num;
double b;
}; struct student k[1000]; bool cmp(const student&a,const student&c){

return a.b>c.b;
} int main() {

int n,m;
cin>>n>>m;
for(int i=0; i<n; i++) {
	cin>>k[i].num>>k[i].b;
}
sort(k,k+n,cmp);
cout<<k[m-1].num<<" "<<k[m-1].b;
return 0;
}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复