/ OPS / 题库 /

Sequence Problem

Sequence Problem

#描述#
You are given a integer sequence with length N. We name this sequence as A[]; <br>
I defined 2 kinds of operation on A[]. Here they are:

<ul>
<li>Add L R : for every L<=i<=R, do operation A[i]+=i-L; </li>
<li>Q L R : query the value of A[L]+A[L+1]+...+A[R] </li>
</ul>
At first, the elements in A[] are all 0.

#格式#
##输入格式##
several test case. first line ,2 integers N and O, means the length of the sequence and the commands.
O lines follow. Each line represent an operation.
specifically 1&lt=N,O&lt=100000 and 0&lt=L&lt=R&ltN

##输出格式##
for every case, output "Case #%d:" first. see the example for detail.
then the query value.

#样例1#
##样例输入1##

5 5
Add 0 4
Q 0 1
Q 0 0
Q 1 4
Q 3 4
5 3
Q 0 4
Add 0 3
Q 2 3

##样例输出1##

Case #1:
1
0
10
7
Case #2:
0
5

#限制#
2000ms
32768KB

#提示#

#来源#
dd

信息

ID
1931
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者