In long flights, airlines offer hot meals. Usually the flight attendants push carts containing the meals down along the aisles of the plane. When a cart reaches your row, you are asked right away: “Chicken, beef, or pasta?” You know your choices, but you have only a few seconds to choose and you don’t know how your choice will look like because your neighbor hasn’t opened his wrap yet. . .
As an example, consider that the available number of meals for chicken, beef and pasta are respectively (80, 20, 40), while the number of passenger’s choices for chicken, beef and pasta are respectively (45, 23, 48). In this case, eleven people will surely not receive their selection for a meal, since three passengers who wanted beef and eight passengers who wanted pasta cannot be pleased.
Input Samples | Output Samples |
80 20 40 45 23 48 | 11 |
0 0 0 100 100 100 | 300 |
41 42 43 41 42 43 | 0 |
URI 2702 Solution in Python:
A1, B1, C1 = map(int,input().split())
A2, B2, C2 = map(int,input().split())
S = 0
if A2>A1:
S = S + (A2 - A1)
if B2>B1:
S = S + (B2 - B1)
if C2>C1:
S = S + (C2 - C1)
print(S)
Comments
Post a Comment