社区讨论
0分求条
P1168中位数参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mhjrt8yz
- 此快照首次捕获于
- 2025/11/04 07:28 4 个月前
- 此快照最后确认于
- 2025/11/04 07:28 4 个月前
0分求条
CPP#include <bits/stdc++.h>
using namespace std;
priority_queue<int> q;
queue<int> ans;
int n;
int main(){
cin >> n;
int y;
for(int i=1; i<=n; i++){
int num;
cin >> num;
q.push(num);
if(i % 2 == 1) ans.push(num);
}
while(ans.size()){
cout << ans.front() << endl;
ans.pop();
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...