Advertisement
DemetriosReis

Untitled

May 27th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import sys
  2. import copy
  3.  
  4. sys.setrecursionlimit(9876543)
  5.  
  6. quant = int(input())
  7.  
  8. list = []
  9. rm = []
  10.  
  11.  
  12. def pwr(m):
  13.  
  14. for n in range(1, m+1):
  15.  
  16. melh = -1
  17.  
  18. for k in range(j):
  19.  
  20. num1 = list[k] + rm[j-(w+1)]
  21.  
  22. if melh < num1:
  23.  
  24. melh = list[k] + rm[j-(w+1)]
  25.  
  26. rm[j] = melh
  27.  
  28. return rm[m]
  29.  
  30.  
  31. while(quant!=0):
  32.  
  33. list = []
  34.  
  35. rm = [-1 for i in range(quant+15)]
  36.  
  37. rm[0] = 0
  38.  
  39. for m in range(quant):
  40.  
  41. list.append(int(input()))
  42.  
  43.  
  44. print(pwr(quant))
  45. quant = int(input())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement