Problem fractional_knapsack
User Tyx2019
Submission Time 2023-02-08 14:09:03
Score 0
Max Time N/A
Max Memory N/A

Compile Error

fractional_knapsack.cpp: In function ‘int main()’:
fractional_knapsack.cpp:4:9: error: expected unqualified-id before ‘long’
4 | int N, long double W;
| ^~~~
fractional_knapsack.cpp:5:14: error: ‘W’ was not declared in this scope
5 | cin >> N >> W;
| ^
fractional_knapsack.cpp:18:12: error: invalid types ‘std::pair<long double, long double> [N][long double]’ for array subscript
18 | if(W<=A[i].second){
| ^
fractional_knapsack.cpp:19:13: error: invalid types ‘std::pair<long double, long double> [N][long double]’ for array subscript
19 | maks+=A[i].first*W;
| ^
fractional_knapsack.cpp:22:9: error: invalid types ‘std::pair<long double, long double> [N][long double]’ for array subscript
22 | W-=A[i].second;
| ^
fractional_knapsack.cpp:23:12: error: invalid types ‘std::pair<long double, long double>