This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
// 视频讲解:https://www.bilibili.com/video/BV1SL4y187x6
// 初步思考:t=1,t=2开始尝试解决
using namespace std;
const int N = 110;
int w[N][N], f[N][10010];
int main() {
int t, n, m;
cin >> t >> n >> m;
for (int i = 1; i <= t; i++)
for (int j = 1; j <= n; j++)
cin >> w[i][j];
if (t == 1)
printf("%d\n", m);
else if (t == 2) {
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
f[i][j] = f[i - 1][j];
if (j >= w[1][i])
f[i][j] = max(f[i][j], f[i][j - w[1][i]] + w[2][i] - w[1][i]);
}
printf("%d\n", m + f[n][m]);
return 0;