关于POJ 这题的题号是多少?一个关于整数的简单问题Time Limit:5000MS Memory Limit:131072KTotal Submissions:16478 Accepted:4207Case Time Limit:2000MS【描述】你有N个整数A1,A2,……AN,你必须用两种操作来处理.一种
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 20:41:23
关于POJ 这题的题号是多少?一个关于整数的简单问题Time Limit:5000MS Memory Limit:131072KTotal Submissions:16478 Accepted:4207Case Time Limit:2000MS【描述】你有N个整数A1,A2,……AN,你必须用两种操作来处理.一种
关于POJ 这题的题号是多少?
一个关于整数的简单问题
Time Limit:5000MS Memory Limit:131072K
Total Submissions:16478 Accepted:4207
Case Time Limit:2000MS
【描述】
你有N个整数A1,A2,……AN,你必须用两种操作来处理.一种操作是给定一个数字和一个区间,在区间中的每个数分别加上所给定的数字.另一种操作是给定一个区间,询问区间中数字的总和.
【输入】
第一行包括两个数字N和Q.1
关于POJ 这题的题号是多少?一个关于整数的简单问题Time Limit:5000MS Memory Limit:131072KTotal Submissions:16478 Accepted:4207Case Time Limit:2000MS【描述】你有N个整数A1,A2,……AN,你必须用两种操作来处理.一种
POJ 3468
A Simple Problem with Integers
Time Limit:5000MS Memory Limit:131072K
Total Submissions:15365 Accepted:3840
Case Time Limit:2000MS
Description
You have N integers,A1,A2,...,AN.You need to deal with two kinds of operations.One type of operation is to add some given number to each number in a given interval.The other is to ask for the sum of numbers in a given interval.
Input
The first line contains two numbers N and Q.1 ≤ N,Q ≤ 100000.
The second line contains N numbers,the initial values of A1,A2,...,AN.-1000000000 ≤ Ai ≤ 1000000000.
Each of the next Q lines represents an operation.
"C a b c" means adding c to each of Aa,Aa+1,...,Ab.-10000 ≤ c ≤ 10000.
"Q a b" means querying the sum of Aa,Aa+1,...,Ab.
Output
You need to answer all Q commands in order.One answer in a line.
Sample Input
10 51 2 3 4 5 6 7 8 9 10
Q 4 4
Q 1 10
Q 2 4
C 3 6 3
Q 2 4
Sample Output
4 55 9 15