Question
The Gocargo carriers has planned to automate the filling of cargos in the container. They have installed a weight detection sensor in the conveyor belt
The Gocargo carriers has planned to automate the filling of cargos in the container. They have installed a weight detection sensor in the conveyor belt where cargos will be taken to the container. The sensor needs to be programmed in a way that it stops the conveyor sending the cargos, when the maximum capacity of the container is reached or exceeded. Please write a code to enable the sensor to automate this task of finding the number of cargos that can be accommodated in the container. Input Format : Input consists of integers, where the first line corresponds to the maximum weight of the container in tonnes. The next lines corresponds to the weight of the cargos in tonnes. Note: Get the inputs till the maximum weight is reached. Output Format : Output consists of an integer which corresponds to the number of cargos that can be accommodated in the container. Refer to sample input and output for formatting specifications. Sample Input: 100 25 35 30 40 Sample Output: 3 Explanation for sample: Total weight of the container = 100. Weight of 1st cargo = 25. Remaining weight = 75. Weight of 2nd cargo = 35. Remaining weight = 40. Weight of 3rd cargo = 30. Remaining weight = 10. Weight of 4th cargo = 40. 4th cargo cannot be accomodated in the container. Therefore, total cargos accomodated = 3.
PYTHON CODE needed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started