-
Notifications
You must be signed in to change notification settings - Fork 1
/
B.cpp
58 lines (44 loc) · 887 Bytes
/
B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 2e18
struct node {
ll sz;
ll id;
}ara[100009];
bool cmp(node a, node b)
{
return a.sz > b.sz;
}
int main()
{
ll n, a, b, f, sum = 0;
cin >> n >> a >> b;
for(ll i = 0; i < n; i++) {
scanf("%lld", &ara[i].sz);
ara[i].id = i;
if(i == 0) {
f = ara[i].sz;
}
sum += ara[i].sz;
}
double tmp = (f * a * 1.0) / sum;
if(tmp >= (b * 1.0)) {
printf("0\n");
return 0;
}
sort(ara, ara + n, cmp);
ll cnt = 0;
for(ll i = 0; i < n; i++) {
if(ara[i].id == 0)
continue;
sum -= ara[i].sz;
double am = (f * a * 1.0) / sum;
cnt++;
if(am >= (b * 1.0) ) {
printf("%lld\n", cnt);
return 0;
}
}
return 0;
}