You are viewing a single comment's thread. Return to all comments →
can you explain why my code is not giving output for testcase 8 only.
def chocolateFeast(n, c, m): inichoc=n//c total=inichoc leftwrap=0 i=0 while inichoc+leftwrap>=m: addchoc=math.floor((inichoc+leftwrap)/m) leftwrap=(inichoc-i)%m total+=addchoc inichoc=addchoc i+=1 return total
Seems like cookies are disabled on this browser, please enable them to open this website
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
can you explain why my code is not giving output for testcase 8 only.
def chocolateFeast(n, c, m): inichoc=n//c total=inichoc leftwrap=0 i=0 while inichoc+leftwrap>=m: addchoc=math.floor((inichoc+leftwrap)/m) leftwrap=(inichoc-i)%m total+=addchoc inichoc=addchoc i+=1 return total