很简单的01分数规划问题 二分答案即可 由于a[i] <= b[i] 所以上界一定小于等于1
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define REP(i, a, b) for(int i = a; i < b; i++)
const int maxn = 1000 + 10;
const double eps = 1e-8;
int n, k;
double a[maxn], b[maxn], c[maxn];
void solve(){
REP(i, 0, n) scanf("%lf", &a[i]);
REP(i, 0, n) scanf("%lf", &b[i]);
double l = 0, r = 1, sum, m;
while(l + eps < r){
m = (l + r) / 2;
sum = 0;
REP(i, 0, n) c[i] = a[i] - m * b[i];
sort(c, c + n);
REP(i, k, n) sum += c[i];
if(sum > eps) l = m;
else r = m;
}
printf("%d\n", int(l * 100 + 0.5));
}
int main()
{
while(~scanf("%d%d", &n, &k) && n) solve();
return 0;
}