Advertisement
Bad_Programist

Untitled

Jan 31st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.16 KB | None | 0 0
  1. n = int(input())
  2. res = 0
  3. N = sorted(list(map(int, input().split())))
  4. while len(N) != 0:
  5.     res += (N[0] + N[-1]) ** 2
  6.     N.pop(0)
  7.     N.pop(-1)
  8. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement