-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseaMoney.py
34 lines (30 loc) · 913 Bytes
/
seaMoney.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from itertools import combinations
num_of_rods = int(input(""))
length = input("")
import numpy as np
def remover(first,second):
# second = second[:]
first = first[:]
for element in second:
first.remove(element)
return first
arr_length =list(map( int, length.split(sep=" ")))
print(arr_length)
largest = []
#nparrlen = np.array(arr_length )
for i in range( 1 , len(arr_length) +1):
for combination in combinations(arr_length , i):
print('combination' ,combination )
complement = remover(arr_length , combination)
print('complement' , complement )
print('sum complement' , sum(complement) )
print("sum combination " , sum(combination))
if sum(complement) == sum(combination):
print('here')
largest.append(sum(complement))
print()
print(largest)
if len(largest) == 0:
print(0)
else:
print(max(largest))