求调
  • 板块灌水区
  • 楼主eggyparty
  • 当前回复4
  • 已保存回复5
  • 发布时间2024/10/3 15:16
  • 上次更新2024/10/3 17:25:00
查看原帖
求调
1201634
eggyparty楼主2024/10/3 15:16

P7072,45分

#include<bits/stdc++.h>
using namespace std;
int a[100001],s[100001];
void sort(int a[],int n)
{
    for(int i=1,maxn;i<=n;i++)
    {
        maxn=i;
        for(int j=i+1;j<=n;j++)
        {
            if(a[j]>a[maxn])
                maxn=j;
        }
        swap(a[i],a[maxn]);
    }
}
int main()
{
    double n,w,x;
    cin>>n>>w;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        s[i]=a[i];
        sort(s,i);
        x=max(1.0,floor(i*(w/100)));
        cout<<s[(int)x]<<' ';
    }
    return 0;
}
2024/10/3 15:16
加载中...