Problem lunchbox
User jeberechieze
Submission Time 2026-10-28 11:11:34
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lunchbox.cpp: In function ‘int main()’:
lunchbox.cpp:10:4: error: expected primary-expression before ‘while’
10 | + while (count < b && sum + c[count] <= b) {
| ^~~~~
lunchbox.cpp:14:1: error: no match for ‘operator+’ (operand type is ‘std::ostream’ {aka ‘std::basic_ostream<char>’})
14 | + cout << count;
| ^~~~~~~
lunchbox.cpp:14:1: note: candidate: ‘operator+(int)’ <built-in>
lunchbox.cpp:14:1: note: no known conversion for argument 1 from ‘std::ostream’ {aka ‘std::basic_ostream<char>’} to ‘int’
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
from /usr/include/c++/9/bits/specfun.h:45,
from /usr/include/c++/9/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
from lunchbox.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:423:5: note: candidate: ‘template<class _Iterator> constexpr std