include [HTML_REMOVED]
using namespace std;
const int N = 1010;
int n, m;
int f[N];
int main()
{
cin >> n >> m;
for (int i = 0; i < n; i ++ )
{
int v, w;
cin >> v >> w;
for (int j = m; j >= v; j – )
f[j] = max(f[j], f[j - v] + w);
}
cout << f[m] << endl;
return 0;
}
cout<<f[m]<<endl;
怎么在main()外头??$QwQ$MarkDown了解一下
谢谢建议