//// main.cpp// poj3624Cpp//// Created by 韩雪滢 on 12/11/16.// Copyright © 2016 韩雪滢. All rights reserved.//#include#include using namespace std;int main() { int N,M; cin >> N >> M; int *des = new int[M+1]; for(int i=0;i<=M;i++) des[i] = 0; for(int j=0;j > w >> d; for(int k=M;k>0;k--) { if(k-w >= 0){ des[k] = max(des[k],des[k-w]+d); } } } int result = 0; for(int n=1;n<=M;n++){ if(des[n] > result) result = des[n]; } cout << result << endl; return 0;}