-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.py
More file actions
31 lines (28 loc) · 688 Bytes
/
temp.py
File metadata and controls
31 lines (28 loc) · 688 Bytes
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
paints= []
colors= 2
for col in range(colors):
paints.append([])
def check(i,col ,paints):
print (paints)
for pos, n1 in enumerate(paints[col]):
for n2 in paints[col][pos:]:
if i== n1+n2:
return (n1,n2)
return False
max_num = 0
def paint(i,col,colors):
a = check(i,col,paints)
#print ("Number %s Color%s" %(i,col))
if a:
global max_num
if i > max_num:
max_num = i
print ("%s %s" %(i, a))
#paints[col].pop()
return
paints[col].append(i)
for c in range(colors):
paint(i+1, c, colors)
paints[col].pop()
paint(1,0,colors)
print("max num "+str(max_num))