有没有大佬帮帮蒟蒻。
  • 板块P1168 中位数
  • 楼主shery2046
  • 当前回复3
  • 已保存回复3
  • 发布时间2025/1/22 19:51
  • 上次更新2025/1/22 22:15:17
查看原帖
有没有大佬帮帮蒟蒻。
741246
shery2046楼主2025/1/22 19:51

40分的RE,求调。

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3e7;

int n;
int a[N], sum[N], mid[N];

signed main() {
	// 输入
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	// 处理
	for (int i = 1; i <= n; i += 2) {
		sort(a + 1, a + i + 1);
		cout << a[i / 2 + 1] << endl;
	}
	// 输出
	return 0;
}
2025/1/22 19:51
加载中...