Tổng đoạn [l,r]

View as PDF

Submit solution

Points: 1.00
Time limit: 1.0s
Memory limit: 64M
Input: stdin
Output: stdout

Authors:
Problem type

Cho mảng 1 chiều gồm ~n~ phần tử số nguyên. Hãy tính tổng các phần tử trong đoạn từ ~l~ đến ~r~.

INPUT

Dòng đầu tiên lần lượt là 3 số nguyên ~n~ ~l~ ~r~ ~(2 \leq l \leq r \leq n \leq 10^3)~

Dòng tiếp theo chứa n số nguyên ~a_0,a_1,a_2,...,a_{n-1} (1 \leq a_i \leq 10^6)~

OUTPUT

Đáp án của bài toán

SAMPLE INPUT 1

5 1 3
1 2 3 4 5

SAMPLE OUTPUT 1

9

Comments

Please read the guidelines before commenting.


There are no comments at the moment.