参考代码:
#include <iostream>
#include <cmath>
using namespace std;
int n, w, a[609],x;
int main()
{
cin >> n >> w;
for (int i = 1; i <= n; i++)
{
cin >> x;
a[x] += 1;
int t = max(1, (int)floor(i * w / 100));
int cnt = 0;
for (int j = 600; j >= 0; j--)
{
cnt += a[j];
if (cnt >= t)
{
cout << j << " ";
break;
}
}
}
return 0;
}