Files
python/TangDou/CSP-J/J2_2020/2_Bucket.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

27 lines
678 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}