30分求解
查看原帖
30分求解
221435
wrtleo楼主2020/11/11 20:07

5555~~~ 为什么我才30分??

#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[101],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;
} 

点击这里见证蒟蒻的辛酸史

2020/11/11 20:07
加载中...