1 条题解

  • 0
    @ 2026-4-18 14:39:42

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

    struct Student { int id; float score; };

    bool cmp(Student a, Student b) { return a.score > b.score;

    }

    int main() { int n, k; cin >> n >> k; Student a[105]; 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 << endl; return 0; }

    • 1

    信息

    ID
    16932
    时间
    1000ms
    内存
    512MiB
    难度
    1
    标签
    递交数
    30
    已通过
    11
    上传者