제출 #1023617

#제출 시각아이디문제언어결과실행 시간메모리
1023617vjudge1Knapsack (NOI18_knapsack)C11
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N, S; cin >> N >> S; vector<int> dp(S + 1, 0); for (int i = 0; i < N; ++i) { int V, W, K; cin >> V >> W >> K; for (int j = 1; K > 0; j <<= 1) { int count = min(j, K); K -= count; int weight = W * count; int value = V * count; for (int w = S; w >= weight; --w) { dp[w] = max(dp[w], dp[w - weight] + value); } } } cout << dp[S] << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

knapsack.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.