You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
678 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
int n, w;
const int N = 610;
int b[N];
// 可以AC原因n*600
int main() {
cin >> n >> w;
for (int i = 1; i <= n; i++) { // 在线性
int x;
cin >> x;
b[x]++; // 分值x,记数+1
int cnt = max(1, i * w / 100); // 目前的获奖人数
int sum = 0;
for (int j = 600; j >= 0; j--) { // 从后向前查找,找出分数由高到低的,并且,人数要够数的
sum += b[j];
if (sum >= cnt) {
printf("%d ", j);
break;
}
}
}
return 0;
}