85分求调
查看原帖
85分求调
755270
jzc114514楼主2024/11/1 20:20
#include<bits/stdc++.h>
using namespace std;
int n,s[100001],cnt;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>s[i];
	sort(s+1,s+n+1);
	int p=1,q=2;
	while(q<=n){
		while(s[q]<=s[p]){
			if(q>n){
				cout<<cnt;
				return 0;
			}
			q++;
		}
		cnt++;
		p++;q++;
	}
	cout<<n-cnt;
}
2024/11/1 20:20
加载中...