链接:
https://vjudge.net/problem/Gym-100741A
题意:
Mathematicians are interesting (sometimes, I would say, even crazy) people. For example, my friend, a mathematician, thinks that it is very fun to play with a sequence of integer numbers. He writes the sequence in a row. If he wants he increases one number of the sequence, sometimes it is more interesting to decrease it (do you know why?..) And he likes to add the numbers in the interval [l;r]. But showing that he is really cool he adds only numbers which are equal some mod (modulo m).
Guess what he asked me, when he knew that I am a programmer? Yep, indeed, he asked me to write a program which could process these queries (n is the length of the sequence):
p r It increases the number with index p by r. (, )
You have to output the number after the increase.p r It decreases the number with index p by r. (, ) You must not decrease the number if it would become negative.
You have to output the number after the decrease.
s l r mod You have to output the sum of numbers in the interval which are equal mod (modulo m). () ()
思路:
看半天没看懂题.
建10个树状数组即可, 对模m的每种情况分别统计.
代码:
#include
#include
#include
#include
//#include
#include
#include
#include