为什么有这个'sort'报错
查看原帖
为什么有这个'sort'报错
1420260
like_zwy楼主2025/7/29 14:51
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
const int N = 100010;
int r[N],n,vis[N],t;
int main(){
	cin>>n;
	for(int i = 1;i<=n;i++){
		cin>>r[i];
	}
	sort(r+1,r+1+n);
	t = n;
	int j = 1;
	for(int i = 2;i<=n;i++){
		if(r[i]>r[j]){
			t--;
			j++;
		}
	}
	cout<<n-t;
	return 0;
}
2025/7/29 14:51
加载中...