AcWing 3633. 删除最大最小数
原题链接
简单
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y;
int f[N];
int maxi = 0, mini = 1001;
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> f[i];
maxi = max(maxi, f[i]);
mini = min(mini, f[i]);
}
for(int i = 1;i<=n;i++){
if(f[i]==maxi||f[i]==mini)continue;
cout<<f[i]<<" ";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}