평범한 배낭

· 백준
코드#include #include #include using namespace std;int n,k,w,v, a[100003][103];vector> itm;int go(int weight, int idx) { if(weight > k) return -987654321; // 무게 제한을 벗어나면 무효 if(idx == n) return 0; // 모든 물건을 확인한 경우 종료 if(a[weight][idx] != -1) return a[weight][idx]; // 이미 계산된 값 // 배낭을 선택하는 경우와 선택하지 않는 경우 비교 int include = go(weight + itm[idx].first, idx + 1) + itm[idx].second; int exclude = go(..