Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import copy
- sys.setrecursionlimit(9876543)
- quant = int(input())
- list = []
- rm = []
- def pwr(m):
- for n in range(1, m+1):
- melh = -1
- for k in range(j):
- num1 = list[k] + rm[j-(w+1)]
- if melh < num1:
- melh = list[k] + rm[j-(w+1)]
- rm[j] = melh
- return rm[m]
- while(quant!=0):
- list = []
- rm = [-1 for i in range(quant+15)]
- rm[0] = 0
- for m in range(quant):
- list.append(int(input()))
- print(pwr(quant))
- quant = int(input())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement