提交时间:2024-07-31 16:22:11
运行 ID: 49914
#include<bits/stdc++.h> using namespace std; struct stu{ int ID; float score; } a[1005]; int n, k;//人数、名次 bool cmp(stu x, stu y){ return x.score > y.score; } int main() { cin >> n >> k; for( int i=1;i<=n;i++) { cin>> a[i].ID >> a[i].score; } sort(a+1, a+n+1 , cmp); cout << a[k].ID <<" "<< a[k].score; return 0; }