Forezz

ДЗ 13 Н 2

Aug 6th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. def max_v(i):
  2. if i == 1:
  3. return cost[1]
  4. elif i == 2:
  5. return cost[2]
  6. else:
  7. return min(max_v(i - 1) + cost[i], max_v(i - 2) + cost[i])
  8. cost = [0, 5, 2, 18, 3, 24, 15, 8, 10]
  9. print (max_v(int(input())))
Advertisement
Add Comment
Please, Sign In to add comment