[KnapSack] 백준 1495:
#include <iostream> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N, M, S; cin >> N >> S >> M; vector<int> volume(N); for (int i = 0; i < N; i++) { cin >> volume(i); } vector<vector<int>> dp(N + 1, vector<int>(M + 1)); dp(0)(S) = 1; for (int i = 1; … Read more