✅
P7072 100pts 桶排序
This commit is contained in:
parent
1bb46a2ec5
commit
8fc5fa15dd
@ -27,4 +27,5 @@ add_executable(Playground
|
|||||||
insert-sort/main.cc
|
insert-sort/main.cc
|
||||||
csp-decode/main.cc
|
csp-decode/main.cc
|
||||||
palin/main.cc
|
palin/main.cc
|
||||||
csp-backpack/main.cc)
|
csp-backpack/main.cc
|
||||||
|
csp-awarding/main.cc)
|
||||||
|
25
csp-awarding/main.cc
Normal file
25
csp-awarding/main.cc
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int bkt[1005];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int n, w;
|
||||||
|
cin >> n >> w;
|
||||||
|
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
int ele;
|
||||||
|
cin >> ele;
|
||||||
|
bkt[ele]++;
|
||||||
|
int tot = 0;
|
||||||
|
for (int j = 600; j >= 0; j--) {
|
||||||
|
tot += bkt[j];
|
||||||
|
if (tot >= max(1, (i + 1) * w / 100)) {
|
||||||
|
printf("%d ", j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user