当前位置:首页 > 题库 > 正文内容

PROGRAMMING:museum

Luz1个月前 (05-10)题库19
Once upon a time, there was such a large museum that tens of thousands of people would visit it every day to enjoy the art works here. On this day, there were n groups of people coming to the museum. The first group consisted of AI people and a tour guide. They arrived in turn, but at the same time, some groups of people left. Due to the large number of people, the management staff of the museum handed you some tables. Please count the number of people left.
###Input format:
The first line is an integer n, followed by N lines. There are two numbers in each row. The first number is X. if x = 0, then it is followed by a number AI, indicating that an AI person is coming; If x = 1, then there will be a number y next, which means that the y-th batch of the coming people has left.
###Output format:
A number means how many people are left.
###Input example:
```in
six
0 5
0 6
1 1
0 7
0 8
1 3
```

### Output example:
```out
sixteen
```
[example explanation]
There are four groups of people, each with a guide, six, seven, eight, nine people respectively, leaving the first and third groups, that is, six + eight = 14 people left, and seven + nine = 16 people left.
[data scope and agreement]
For 30% data, 1 ≤ n ≤ 100, 1 ≤ AI ≤ 1000;
For 100% data, 1 ≤ n ≤ 1000000, 1 ≤ AI ≤ 1000000.
Guarantee: X is only 0 or 1, y must meet the requirements< br>





answer:If there is no answer, please comment
分享给朋友:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。