#5070. The bottom of the ninth
The bottom of the ninth
The bottom of the ninth
题目描述
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.
输入格式
The input is given from Standard Input in the following format:
输出格式
Print the minimum number of runs Team Aoki needs to score in the bottom of the ninth inning to win.
0 1 0 1 2 2 0 0 1
1 1 0 0 0 0 1 0
5
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1
提示
$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.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.
标签: AtCoder|abc351A
来源
AtCoder|abc351A