解题思路:
注意事项:
参考代码:
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int,double> baishu;
const int N =100;
baishu a[N];
bool cmp(const baishu& a, const baishu& b) {
return a.second > b.second;
}
int main()
{
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
{
int s;double b;
cin>>s>>b;
a[i]={s,b};
}
sort(a,a+n,cmp);
printf("%d %g",a[k-1].first,a[k-1].second);
return 0;
}
0.0分
1 人评分