You are viewing a single comment's thread. Return to all comments →
Python:
def workbook(n, k, arr): p=1 # counter that references the overall page number a=1 # counter that references the chapter-specific page number sp=0 # Counter for special problems for i in arr: if i>=p: for j in range(p,p+math.ceil(i/k)): # Iterating through each page for each chapter if j in range(k*(a-1)+1,min(k*a,i)+1): sp+=1 a+=1 a=1 # Reinitializing after the current chapter ends p=p+math.ceil(i/k) # Updating current page number return sp
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 →
Python: