-->
当前位置:首页 > 题库

PROGRAMMING:Interval 1

Luz5年前 (2021-05-10)题库361
There are n integers, Q queries, each query gives you an interval and a number, you need to add a given number for each number in a given interval.
It sounds simple, but Keven wants to know the sum of an interval before a certain interval is changed. Can you help him?
###Input format:
The first line contains two numbers N and Q: (1 ≤ n ≤ 200000)
The second line contains n numbers. A1,A2,...,AN (-1e4≤Ai≤1e4)
Each of the following lines represents an operation.
"0 a B C" means to add C, a a + 1,..., ab (- 1E4 ≤ C ≤ 1E4) to each AA
"1 a B" means to query AA, a + 1,..., ab.
###Output format:
You need to answer all the queries for action 1 in order. One answer per line.
###Input example:
Here is a set of inputs. For example:
```in
10 5
1 2 3 4 5 6 7 8 9 10
1 4 4
1 1 10
1 2 4
0 3 6 3
1 2 4
```
###Output example:
The corresponding output is given here. For example:
```out
four
fifty-five
nine
fifteen
```







answer:If there is no answer, please comment