|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||256 MB||87||30||27||35.526%|
A game consists of putting beads in boxes. The rules of the game are too complex to describe here, but all you need to know is that keeping track of the number of beans in adjacent boxes are very important to the outcome of the game.
You are asked by a friend to write a program to help him win the game every time. At the start of a game, all boxes are empty.
The first line of the input consists of a single number T, the number of games played. Each game start with a line describing B, P and Q, the number of boxes, put requests and query requests, respectively.
Then follows P + Q lines with either
P i a, saying
a beads are put in box number
Q i j, a query request for the number of beads in boxes
BufferedReaderfor input reading (not
Scanner). It is also beneficial to build all output in a
StringBuilderbefore printing in a single print statement.
For each query request, output the number of beads in boxes
b, inclusive, that are in the boxes at this point of the game.
1 7 5 3 P 2 1 P 3 3 P 4 7 Q 1 4 P 7 6 Q 4 4 P 6 4 Q 1 7
11 7 21