谢谢!
@Ecky7
#include<bits/stdc++.h> using namespace std; struct xs{ string xm; int cj; }; bool cmp(xs q,xs h){ return q.cj>h.cj; } int main(){ xs a[21]; int n,k; cin>>n>>k; for(int i=1;i<=n;i++){ cin>>a[i].xm>>a[i].cj; } sort(a+1,a+n+1,cmp); cout<<a[k].xm<<" "<<a[k].cj; return 0; }
共 2 条回复
谢谢!
@Ecky7