大紫大绿65pts
查看原帖
大紫大绿65pts
1262434
hsy2024楼主2024/10/15 17:48

代码:

//TLE YYDS
#include <bits/stdc++.h>
using namespace std;

bool cmp(int a,int b)
{
	return a>b;
} 

int main()
{
    int n,w,score[100010]={};
    scanf("%d%d",&n,&w);
    for(int i=1;i<=n;i++)
    {
		scanf("%d",score+i);
	   sort(score+1,score+i+1,cmp);//sort快排
	   int l=max(1,i*w/100);
		cout<<score[l]<<" ";
    }
    return 0;
}
2024/10/15 17:48
加载中...