#A. 【模板】一维前缀和

    Type: Default 1000ms 256MiB

【模板】一维前缀和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

前缀和模板题

Description

给你一个n个元素的数组,我们想求L到R范围内的元素和

Format

Input

第一行输入一个N和M分别表示数组的大小和询问的次数(1<=N<=100000,1<=M<=100000)

第二行到第M+1行每行输入一个L和R,分别表示要求的区间的范围(1<=L<=R<=N)

Output

输出M行区间和

Samples

5 1
1 2 3 4 5
2 5
14

Limitation

1s, 1024KiB for each test case.

差分与前缀和训练

Not Claimed
Status
Done
Problem
6
Open Since
2022-12-14 0:00
Deadline
2022-12-18 23:59
Extension
24 hour(s)