You are viewing a single comment's thread. Return to all comments →
Didn't really bother to work the math out for potentially more effeicent solutions.
Pretty hard problem to get it right and debug imo.
def workbook(n, k, arr): current_page=1 special=0 for chapter in range(1,n+1): nop=arr[chapter-1] counter=0 for problem in range(1,nop+1): counter+=1 if counter==k+1: current_page+=1 counter=1 if problem==current_page: special+=1 print(chapter,problem,current_page,counter,special) current_page+=1 return special
Seems like cookies are disabled on this browser, please enable them to open this website
Lisa's Workbook
You are viewing a single comment's thread. Return to all comments →
Didn't really bother to work the math out for potentially more effeicent solutions.
Pretty hard problem to get it right and debug imo.