A basket contains of three fruits has to be created using apples and mangoes
Saurabh believes that the optimal fruit basket of three fruits should
consist of one
Apple and two mangoes. Adish believes that the two apples and one mango. fruit basket should have
There are A apples and B mangoes. Can you calculate what maximum number of imar.chine baskets that can be formed?
Input Format
The first line contains an integer, A, denoting the number of apples.
The next line contains an integer, B, denoting the the number of mangoes.
constrants
1 <=A<= 10^5
1 <= B <= 10^5
Sample
1
2
1
Sample Output
are only 2 fruits in total, hence no optimalees baskets can be
Only one optimal basket can be made be (A, M, M), where A represents an Apple, and M represents a Mango. niteeshkuma
3 optimal fruit baskets can be made i.e (A, M. M) (A, M, M), (A, A, M). where A represents an Apple, and M represents a Mango itees
def opt_fru(A, B):
sum1 = A + B
if sum1 < 3:
return 0
else:
return sum1/3
opt_fru(1,1)
0
Comments
Leave a comment