够才看

Adolf Hitler  •  5个月前


#include <bits/stdc++.h>
using namespace std;

struct codm {
	string a;
	double b;
};
bool cmp(codm x1,codm x2){
	return x1.b>x2.b;
}

int main() {
	int x,y;
	cin>>x>>y;
	codm k[x];
	for (int i = 0; i < x; i++) {
		cin >> k[i].a >> k[i].b;
	}
	sort(k,k+x,cmp);
	cout<<k[y-1].a<<' '<<k[y-1].b;
	return 0;
}

评论:

请先登录,才能进行评论