一看好弱,一写65分 求大佬指导
查看原帖
一看好弱,一写65分 求大佬指导
1068436
wowa444楼主2024/11/5 20:08
#include<bits/stdc++.h>
using namespace std;
map<int,int> m1;
int main(){	
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int temp;
		cin>>temp;
		m1[temp]++;
	}	
	long long ans=0,temp2=1,a[n]={0};
	for(auto it=m1.begin();it!=m1.end();it++){
		a[temp2]=it->second;
		ans+=a[temp2];		
		ans-=min(a[temp2-1],a[temp2]);
		temp2++;
	}
	cout<<ans;
   return 0;   
}
2024/11/5 20:08
加载中...