Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
29076 while(i++) 前m大的数1 C++ 解答错误 50 22 MS 2196 KB 572 2022-07-10 19:19:36

Tests(5/10):


#include <iostream> #include <set> using namespace std; class compare { public: bool operator()(int a, int b) { return a > b; } }; int main() { int m, n; do { cin >> n >> m; set<int, compare> st; int temp; for(int i = 0; i < n; i++) { cin >> temp; st.insert(temp); } for(set<int, compare>::iterator i = st.begin(); m; i++, m--) { cout << *i << " "; } cout << endl; } while(m && n); return 0; }


测评信息: