https://ac.nowcoder.com/acm/contest/33189/A

(p-1)/w的偏序关系。
#include
using namespace std;
struct node {
long long w;
long long q;
double p;
};
bool cmp(const node &x, const node &y){return (y.q-10000)*x.w > (x.q-10000)*y.w;}
int n, m;
node a[100005];
double mx[50];
void solve()
{
scanf("%d%d", &n, &m);
for (int i=1; i<=n; i++) scanf("%lld", &a[i].w);
for (int i=1; i<=n; i++) scanf("%lld", &a[i].q), a[i].p = a[i].q/10000.0;
sort(a+1, a+n+1, cmp);
//for (int i=1; i<=n; i++) printf("%lld %lf %lf\n", a[i].w, a[i].p, 1.0*(a[i].p-1)/a[i].w);
for (int i=1; i<=m; i++) mx[i] = 0;
for (int i=1; i<=n; i++) {
for (int j=m; j>0; j--) {
mx[j] = max(mx[j], mx[j-1]*a[i].p+a[i].w);
}
}
printf("%.15lf\n", mx[m]);
}
int main()
{
solve();
return 0;
}
/*
5 2
1 2 3 4 5
12000 11000 10000 9000 8000
*/