T503163样例过了但RE,求调,玄关
  • 板块题目总版
  • 楼主osu_rice222
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/8/25 09:35
  • 上次更新2024/8/25 09:38:28
查看原帖
T503163样例过了但RE,求调,玄关
1246000
osu_rice222楼主2024/8/25 09:35
#include <bits/stdc++.h>
using namespace std;
int a[10005],cnt[1005];
int n,ans=0;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	for(int i=0;i<=1000;i++){
		if(cnt[i]!=0){
			int p=cnt[i];
			while(1){
				if(p>i+1){
					p-=i+1;
					ans+=i+1;
				}
				else{
					ans+=i+1;
					break;
				}
			}
		}
	}
	cout<<ans;
	return 0;
}
2024/8/25 09:35
加载中...