There are M number of boys, N number of girls and P number of pets given. A pet race is held for a fun-filled Sunday in a town. Each pet animal is accompanied by two persons for the race. The organiser planning for the seating arrangements by making groups such that each group has three members, and among these members, there is at least one boy and at least one girl, the third member being a boy, a girl, or a pet. One bench is required for each such group. The task is to find the maximum number of benches required for this
def maximum_benches(m, n, p):
return min((m + n + p) // 3, m, n)
Comments
Leave a comment