int n, m; int a[110]; int c[110]; int top; int v[100010]; int dp[100010];
voidInput(){ scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); } for (int i = 1; i <= n; i++) { scanf("%d", &c[i]); int cnt = 1; while (c[i] >= cnt) { v[++top] = cnt * a[i]; c[i] -= cnt; cnt *= 2; } v[++top] = c[i] * a[i]; } }
voidWork(){ dp[0] = 1; for (int i = 1; i <= top; i++) { for (int j = m; j >= v[i]; j--) { if (dp[j - v[i]]) { dp[j] = 1; } } } int ans = 0; for (int i = 1; i <= m; i++) { ans += dp[i]; } printf("%d", ans); }