Відома кількість вантажних машин N та вага в тоннаж кожної машини. Визначити чи зможуть дані машини за один раз перевести об’єм щебня вагою К тон.
решение в Питоне, пожалуйста.
Ответы
Ответ дал:
2
Відповідь:
N = int(input("Enter the number of trucks: "))
weights = []
for i in range(N):
weight = float(input("Enter the weight in tons of truck {}: ".format(i+1)))
weights.append(weight)
K = float(input("Enter the weight in tons of the crushed stone: "))
total_capacity = sum(weights)
if total_capacity >= K:
print("The given trucks can transfer a volume of crushed stone weighing {} tons at one time.".format(K))
else:
print("The given trucks cannot transfer a volume of crushed stone weighing {} tons at one time.".format(K))
Вас заинтересует
1 год назад
1 год назад
1 год назад
3 года назад
8 лет назад