Advertisement
nq1s788

27(2)

Jun 5th, 2024 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=27891
  2. data = open('27.txt').readlines()
  3. n = int(data[0])
  4. x = list(map(int, data[1:]))
  5. a, b, c, d = 0, 0, 0, 0 #a - 14, b - люб, с - 2, d - 7
  6. answ = 0
  7. for e in x:
  8.     if e % 14 == 0:
  9.         answ = max(answ, e * b)
  10.     answ = max(answ, e * a)
  11.     if e % 2 == 0:
  12.         answ = max(answ, e * d)
  13.     if e % 7 == 0:
  14.         answ = max(answ, e * c)
  15.    
  16.     if e % 14 == 0:
  17.         a = max(a, e)
  18.     b = max(b, e)
  19.     if e % 2 == 0:
  20.         c = max(c, e)
  21.     if e % 7 == 0:
  22.         d = max(d, e)
  23. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement