求助
查看原帖
求助
557851
for_to楼主2021/10/20 12:10

已过,但还是不懂为啥这样只有85分

#include<cstdio>
#include<algorithm>
#define N 605

using namespace std;

int n,m,a[N];
double w;

int main(){
	scanf("%d%lf",&n,&w);
	w/=100;
	for(int i=1,x;i<=n;i++){
		scanf("%d",&x);
		a[x]++;
		m=max(1.0,i*w);
//		printf("%d\n",m);
		for(int j=N;j>=0;j--){
			m-=a[j];
			if(m<=0){
				printf("%d ",j);
				break;
			}
		}
	}
	return 0;
}
2021/10/20 12:10
加载中...