Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Auto Painting by TovarischZhukov
# migrated from python 2.7
class Det:
def __init__(self,num):
self.num=num
self.count=0
def paint(self):
self.count+=1
return str(self.num)
def is_complite(self):
return self.count==2
def paint(lstdet):
return "".join([v.paint() for v in lstdet])
def getData(lstdata):
return [x for x in lstdata if not x.is_complite()]
def checkio(capacity, number,i=0,p=1,d=1):
retval=[]
lstdet=getData([Det(k) for k in range(number)])
while lstdet:
if i>=len(lstdet):
i=0;p=0;lstdet=getData(lstdet)
if p and i+capacity*2>len(lstdet):
lstpaint=lstdet[-capacity:]
i=len(lstdet)
else:
lstpaint=lstdet[i:i+capacity]
i+=capacity
if d and len(lstpaint)
Jan. 16, 2016
Comments: