真的是裸背包啊……
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
int n, k[125], c[125], sum[125];
ll m, dp[125][240795];
int main(){
cin>>n>>m;
for(int i=1; i<=n; i++)
scanf("%d", &k[i]);
for(int i=1; i<=n; i++){
scanf("%d", &c[i]);
sum[i] = sum[i-1] + k[i] * c[i];
}
dp[0][0] = 1;
for(int i=1; i<=n; i++)
for(int j=0; j<=sum[i]; j++){
dp[i][j] = dp[i-1][j];
for(int l=1; l<=k[i]; l++)
if(j-l*c[i]>=0){
ll tmp;
if((double)dp[i-1][j-l*c[i]]*l>=m) tmp = m;
else tmp = dp[i-1][j-l*c[i]] * l;
dp[i][j] = max(dp[i][j], tmp);
}
}
for(int i=0; i<=sum[n]; i++)
if(dp[n][i]==m){
printf("%d\\n", i);
return 0;
}
return 0;
}