
James G. answered 07/26/17
Tutor
4.9
(1,012)
Tutor
Some simple math indicates 18 TA's and 12 teachers. To get to the lowest cost you need the maximum allowed TA's in relation to teachers. The max TA's is 3 for every 2 teachers. You also want to minimize the overall staff. The smallest staff that the requirement allow is 30. Both conditions are satisfied by the suggested answer. A program isn't really needed.
# Here is what one that solves this problem might look like.
best_cost = None
for ta in range(30): # 0 thru 29 ta's
te = 30 - ta # calculate number of teachers that adds up to minimum staff
if ta / te > 3 / 2:
break # too many ta, you can stop
cost = ta * 1100 + te * 2400 # calculate cost
if best_cost is None or cost < best_cost:
best_cost = cost
best_ta = ta
best_te = te
print( "Best cost:", best_cost, "TA s:", best_ta, "Teachers:", best_te);