65pts求调
查看原帖
65pts求调
1210934
Messy_楼主2024/7/20 10:58
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int max(int c,int d)
{
	if(c<d) 
	{
		return d;
	}
	if(c>d) 
	{
		return c;
	}
}
int main()
{
	long long w,s[100005],n;
	scanf("%lld%lld",&n,&w);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&s[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(i>1)
		{
			sort(s+1,s+i+1,cmp);
			printf("%lld",s[max(1,i*w/100)]);
			printf(" ");
		}
		else
		{
			printf("%lld",s[1]);
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}
2024/7/20 10:58
加载中...