Submit solution
Points:
0
Time limit:
6.0s
Memory limit:
1G
Author:
Problem type
Allowed languages
Python
For the third hole of
's golf course, he would like you to simply build a prefix sum array and handle range sum queries on it.Input Specification
The first line will contain a list of spaced positive integers.
The next line will contain , the number of range sum queries.
The next lines will contain
spaced integers,
and
, indicating the bounds for the range some query
.
It is guaranteed that and
will be between
and the length of the list of integers inclusive.
The length of the list of integers will not exceed and the number of queries will not exceed
. The integers in the list will not exceed
.
Output Specification
For each query, output the sum of the integers from the -th number to
-th number inclusive.
Scoring
If the program has the correct output, you will receive a score of (for each test case)
if the length of the code in bytes exceeds
if the length of the code in bytes is less than
where
is the length of code in bytes, if
Sample Input 1
2 5 3 1 4
3
1 3
2 4
1 5
Sample Output 1
10
9
15
Comments