Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
36470 | C++|刘一阳 | 谁考了第k名 | C++ | Accepted | 1 MS | 260 KB | 511 | 2024-01-13 16:22:28 |
#include <bits/stdc++.h> using namespace std; struct node { int b; double c; }; bool cmp(const node &a,const node &b) { return a.c>b.c; } node a[105]; int main() { int n,k,s; cin>>n>>k; for(int i=1;i<=n;i++) { cin>>a[i].b>>a[i].c; } sort(a+1,a+n+1,cmp); int sum=0; for(int i=1;i<=n;i++) { sum++; if(sum==k) { cout<<a[i].b<<" "<<a[i].c; break; } } return 0; }