Set 102Question 51

Ayesha's Range Total

MediumWritten in CMust finish in 2 seconds

Ayesha needs the sum of entries between two positions in a growing daily log at a transport authority.

What your program reads

Line1: N. Line2: N integers. Line3: L R.

What your program prints

Sum of a[L..R].

Limits

1 ≤ L ≤ R ≤ N ≤ 10^5

Example input

5
1 2 3 4 5
2 4

Expected output

9
main.c

Your work is saved in this browser as you type.

Loading editor…
Input for Run

Run tries your code on the input above and shows what it prints. Submit checks your output against every test, including hidden ones.

Shortcut: Ctrl + Enter sends it to the judge.

Ayesha's Range Total · DIU ContestHub