Advertisement
Guest User

Untitled

a guest
May 27th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. n = int(input())
  2.  
  3. #встроенным максимумом на егэ
  4. #пользоваться нельзя
  5. def max(a, b):
  6.     if (a > b):
  7.         return a
  8.     return b
  9.  
  10. a = [0] * 9
  11.  
  12. for i in range(9):
  13.     a[i] = int(input())
  14.  
  15. mxo = 0 #max odd
  16. mxe = 0 #max even
  17. ans = 0 #answer
  18.  
  19. for i in range(n - 9):
  20.     #обновление максимумов
  21.     if (a[i % 9] % 2 == 0):
  22.         mxe = max(a[i % 9], mxe)
  23.     else:
  24.         mxo = max(a[i % 9], mxo)
  25.     #считал+обновил ответ
  26.     x = int(input())
  27.     if (x % 2 == 0):
  28.         ans = max(ans, x * max(mxe, mxo))
  29.     else:
  30.         ans = max(ans, x * mxe)
  31.     #обновил мою очередь
  32.     a[i % 9] = x
  33.  
  34. print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement