human
What is a code to minimize product of two scores possible by at most M reductions and the other steps required given the following:
Minimize product of two scores possible by at most M reductions | Utility function to find the minimum product of R1 and R2 possible.
Reaching to its limit.
If M is remaining.
Function to find the minimum product of R1 and R2.
Case 1 - R1 reduces first.
case 2 - R2 reduces first.
Driver Code.
Given Input.
Function Call"
Solution in Python:
assistant
#Here is code to minimize product of two scores possible by at most M reductions and the other steps required.
 def minProductUtil ( R1 , B1 , R2 , B2 , M ) :
	x = min ( R1 - B1 , M )
	M -= x
	R1 -= x
	if M > 0 :
		y = min ( R2 - B2 , M )
		M -= y
		R2 -= y
	return R1 * R2
def minProduct ( R1 , B1 , R2 , B2 , M ) :
	res1 = minProductUtil ( R1 , B1 , R2 , B2 , M )
	res2 = minProductUtil ( R2 , B2 , R1 , B1 , M )
	return min ( res1 , res2 )
if __name__ == ' _ _ main _ _ ' :
	R1 = 21 ; B1 = 10 ; R2 = 13 ; B2 = 11 ; M = 3
	print ( minProduct ( R1 , B1 , R2 , B2 , M ) )