直播获奖 T 70分

题目链接看不见可看洛谷!

#include<bits/stdc++.h>
using namespace std;
int n,w,a[100005],ans,sum;
double s;
int main(){
	freopen("live.in","r",stdin);
  	freopen("live.out","w",stdout);
	scanf("%d%d",&n,&w);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sort(&a[1],&a[i+1]);
		s=i*w/100.0;
		ans=floor(s);
		sum=max(1,ans);
		cout<<a[i-sum+1]<<" "; 
	}
	return 0;
}

蒟蒻认为是思路错了,求dalao给出思路或者我的代码的优化

1 个赞

@王建力

1 个赞