include[HTML_REMOVED]
include[HTML_REMOVED]
int main()
{
int m_backTotal = 0;
int m_backVolTotal = 0;
std::cin>>m_backTotal>>m_backVolTotal;
std::vector[HTML_REMOVED] m_backVol(m_backTotal);
std::vector[HTML_REMOVED] m_backQual(m_backTotal);
std::vector[HTML_REMOVED] m_backDp(m_backVolTotal+1);
for (int i = 0 ; i[HTML_REMOVED]>m_backVol[i]>>m_backQual[i];
}
for (int i = 0 ; i < m_backTotal; ++i)
for (int j = m_backVolTotal - m_backVol[i] ; j >=0; –j)//倒着加因为物品只能放置一次,所谓01背包
{
if ( m_backDp[j] +m_backQual[i] > m_backDp[ m_backVol[i] + j])
{
m_backDp[ m_backVol[i] + j] = m_backDp[j] + m_backQual[i];
}
}
std::cout<<m_backDp[m_backVolTotal]<<std::endl;
return 0;
}