Submission #1172320

#TimeUsernameProblemLanguageResultExecution timeMemory
1172320manowoKnapsack (NOI18_knapsack)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    int s , n;
    cin >> s >> n;
    for(int i = 0; i < n; i++)
    {
        int v , w , k;
        cin >> v >> w >> k;
    }
    cout << v * min(k , s / w);
    return 0;
}

Compilation message (stderr)

knapsack.cpp: In function 'int main()':
knapsack.cpp:15:13: error: 'v' was not declared in this scope
   15 |     cout << v * min(k , s / w);
      |             ^
knapsack.cpp:15:21: error: 'k' was not declared in this scope
   15 |     cout << v * min(k , s / w);
      |                     ^
knapsack.cpp:15:29: error: 'w' was not declared in this scope
   15 |     cout << v * min(k , s / w);
      |                             ^