You are viewing a single comment's thread. Return to all comments →
n,k = map(int,input().split(" ")) x = k list1 = list(map(int,input().split(" "))) final_list1 = [] for i in list1: l1 = [i for i in range(1,i+1)] l2 = [] while len(l1) != 0: l2.append(l1[:x]) l1 = l1[x:] x = min(k,len(l1)) final_list1.extend(l2) final_list2 = [i for i in final_list1 if len(i) != 0] count = len([final_list2[i-1] for i in range(1,len(final_list2)+1) if i in final_list2[i-1]]) print(count)``
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 →