Forezz

ДЗ 13 Н 2 НРМ

Aug 13th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. n = int(input())
  2. pricelist = [0, 5, 2, 18, 3, 24, 15, 8, 10]
  3. price = [0] * (n + 1)
  4. price[1] = pricelist[1]
  5. price[2] = pricelist[2]
  6. for i in range (3, n + 1):
  7.     price[i] = min(price[i - 1], price[i - 2]) + pricelist[i]
  8. print(price[n])
Advertisement
Add Comment
Please, Sign In to add comment