Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
88741 sh25_zhangyj 求第k大数 C++ 解答错误 0 MS 268 KB 414 2026-05-15 15:37:01

Tests(0/1):


#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int k, n; cin >> k >> n; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } // 降序排序 sort(a.begin(), a.end(), greater<int>()); cout << a[k - 1] << endl; return 0; }


测评信息: