Search
Write a publication
Pull to refresh
0
0
Send message
total = 20
cost1 = 5
cost2 = 10
x1 = 0
n1 = total
i1 = total // max(cost1, cost2)
while i1 > 0:
    x1 += (n1 - max(cost1, cost2)) // min(cost1, cost2)
    n1 -= max(cost1, cost2)
    i1 -= 1
print(1 + total // cost1 + total // cost2 + x1)

Получилось как-то так.

Information

Rating
Does not participate
Registered
Activity