Loading...
Loading...
Loading...
A shop records its sales for n days. For several questions, report the total sales from day l to day r, both included. Days are numbered from 1.
Example 1
Input
5 3 -1 4 1 5 2 1 3 2 5
Output
6 9
Totals 6 and 9.
Example 2
Input
3 10 20 30 1 2 2
Output
20
Try the problem first. Open one hint at a time.
Add the sales up once, keeping the running total after each day.
A range total is one running total minus another.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor