pj t2
  • 板块灌水区
  • 楼主Chancylaser
  • 当前回复22
  • 已保存回复22
  • 发布时间2020/11/7 23:27
  • 上次更新2023/11/5 08:32:34
查看原帖
pj t2
241817
Chancylaser楼主2020/11/7 23:27
#include<bits/stdc++.h> 
using namespace std;
int n;
double w;
int a[100005];
int ans[100005];
int b;
bool cmp(int o,int y)
{
	return o>y;
}
int main()
{
	//freopen("live.in","r",stdin);
	//freopen("live.out","w",stdout);
	cin>>n>>w;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		ans[i]=a[i];
		b=max(1,int(i*(w/100)));
		sort(ans+1,ans+i+1,cmp);
		cout<<ans[b]<<" "; 
	}
	return 0;
 } 

写出来两个样例都过了,交计蒜客0分 求差错

2020/11/7 23:27
加载中...