#abc351a. A - The bottom of the ninth
A - The bottom of the ninth
Score: points
问题陈述
高桥队和青木队正在进行一场棒球比赛,高桥队首先击球。 目前,比赛已经进行到了第九局上半局,即将开始第九局下半局。
高桥队在第 局上半局得分为 (),而青木队在第 局下半局得分为 ()。 在第九局上半局结束时,高桥队的得分不低于青木队的得分。 确定青木队在第九局下半局需要得多少分才能赢得比赛。
在这里,如果比赛结束时双方打平,那么结果就是平局。因此,为了赢得比赛,青木队必须在第九局下半局结束时比高桥队多得至少一分。 高桥队在任何时刻的得分是到那时为止上半局得分的总和,而青木队的得分是到那时为止下半局得分的总和。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
Team Takahashi and Team Aoki are playing a baseball game, with Team Takahashi batting first.
Currently, the game has finished through the top of the ninth inning, and the bottom of the ninth is about to begin.
Team Takahashi scored runs in the top of the -th inning , and Team Aoki scored runs in the bottom of the -th inning .
At the end of the top of the ninth, Team Takahashi's score is not less than Team Aoki's score.
Determine the minimum number of runs Team Aoki needs to score in the bottom of the ninth to win the game.
Here, if the game is tied at the end of the bottom of the ninth, it results in a draw. Therefore, for Team Aoki to win, they must score strictly more runs than Team Takahashi by the end of the bottom of the ninth.
Team Takahashi's score at any point is the total runs scored in the tops of the innings up to that point, and Team Aoki's score is the total runs scored in the bottoms of the innings.
Constraints
- $A_1 + A_2 + A_3 + A_4 + A_5 + A_6 + A_7 + A_8 + A_9 \geq B_1 + B_2 + B_3 + B_4 + B_5 + B_6 + B_7 + B_8$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the minimum number of runs Team Aoki needs to score in the bottom of the ninth inning to win.
Sample Input 1
0 1 0 1 2 2 0 0 1
1 1 0 0 0 0 1 0
Sample Output 1
5
At the end of the top of the ninth inning, Team Takahashi has scored seven runs, and Team Aoki has scored three runs.
Therefore, if Team Aoki scores five runs in the bottom of the ninth, the scores will be , allowing them to win.
Note that scoring four runs would result in a draw and not a victory.
Sample Input 2
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Sample Output 2
1