#P2068. 统计和
统计和
Description
Given a sequence of length whose initial values are all , perform modifications on some positions, adding a number each time, and during this process ask queries to find the sum of each interval.
Input Format
The first line contains integer, the length of the sequence .
The second line contains integer, the number of operations .
Then follow lines, each representing an add or a query operation.
Here, add is denoted by x, and query is denoted by y.
The format of is x a b, meaning add to the -th number in the sequence. It is guaranteed that , .
The format of is y a b, meaning query the sum over the interval from to . It is guaranteed that .
Output Format
Each line contains a positive integer, which is the result of each query.
5
4
x 3 8
y 1 3
x 4 9
y 3 4
8
17
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号