2020 March 14 BAPC2019 game Replenishment report

Inquiry I

 

 

 Meaning of the questions:

  Given a number of columns, the maximum seek formula
Ideas:
  You can maintain a prefix and suffix and, once scanned array, you can find the maximum
Code:
n-= int (INPUT ()) 
LST = [* Map (int, INPUT (). Split ())]
 # left recording prefix array elements squared and, right recording array elements suffix and 
left, right = 0, SUM (LST ) 
RES = 0
 for I in LST: 
    left + 2 = I ** 
    right - = I 
    RES = max (RES, left * right)
 Print (RES)

 

Guess you like

Origin www.cnblogs.com/ZhengQC/p/12501156.html