Convertisseur Python en ligne
def billboard (ListOfBillboard, n):
maxArea=0
for i in range (1,n-1) :
minimumLeftside= 1000 # getting the minimum values on left without the value on the current panel
minimumRightside= 1000 # getting the minimum values on right side including the current panel
leftCount =i
rightCount = n- i
for j in range (0,i): #going through the left panels
if (ListOfBillboard[j]<minimumLeftside) : #to find the smallest value left of the current panel
minimumLeftside=ListOfBillboard[j]
for j in range (i,n) :
if (List[j]<minimumRightside):
minimumRightside=List[j]
totalArea = (minimumLeftside+leftCount) + (minimumRightside*rightCount)
if (maxArea<totalArea) :
maxArea = totalArea
print(maxArea)
n =int (input ())
List =list (map (int, input (). split ()))
billboard (List, n)
7amany Zain