求助,还是那道题
  • 板块灌水区
  • 楼主AAAuc03
  • 当前回复7
  • 已保存回复7
  • 发布时间2024/10/2 20:55
  • 上次更新2024/10/2 21:14:27
查看原帖
求助,还是那道题
923362
AAAuc03楼主2024/10/2 20:55

RT

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n; 
    array<int,110000> a;
    multiset<int> m;
    vector<int> b;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        m.insert(a[i]);
        b.push_back(a[i]);
    }
    stable_sort(a.begin(),a.end());
    unique(b.begin(),b.end());
    if(b.size()==1)cout<<0;
    else cout<<n-m.count(a.at(1))-m.count(a.at(n));
    return 0;
}

用STL改了一下,满江红

2024/10/2 20:55
加载中...