Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def max_v(i):
- if i == 1:
- return cost[1]
- elif i == 2:
- return cost[2]
- else:
- return min(max_v(i - 1) + cost[i], max_v(i - 2) + cost[i])
- cost = [0, 5, 2, 18, 3, 24, 15, 8, 10]
- print (max_v(int(input())))
Advertisement
Add Comment
Please, Sign In to add comment