文章
71
粉丝
142
获赞
5
访问
52.7k
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
int a[1005];
int main(){
int n;
while (cin>>n) {
priority_queue<int, vector<int>, greater<int>> q;
for (int i = 0; i < n;i++) {
cin >> a[i];
}
sort(a,a+n);
for (int i = n-1; i >=0;i--) {
if (q.empty()) {
q.push(a[i]);
}
else if(q.top()>a[i]) {
...
登录后发布评论
暂无评论,来抢沙发