Dole Out Cadbury Problem Description You are a teacher in reputed school. During Celebration Day you were assigned a task to distribute Cadbury such that maximum children get the chocolate. You have a box full of Cadbury with different width and height. You can only distribute largest square shape Cadbury. So if you have a Cadbury of length 10 and width 5, then you need to break Cadbury in 5X5 square and distribute to first child and then remaining 5X5 to next in queue Constraints 0
Answers
Answered by
0
Answer:
p=int(input())
q=int(input())
r=int(input())
s=int(input())
c=0
def child_count(i,j):
count=0
while(i!=0 and j!=0):
count+=1
if(i>j):
i-=j
else:
j-=i
return count
for i in range(p,q+1):
for j in range(r,s+1):
c+=child_count(i,j)
print(c)
Explanation:
Similar questions