Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- number = int(input())
- arr = [int(i) for i in input().split()]
- amountOfElement = len(arr)
- best = 0
- i = 0
- while i < amountOfElement:
- summ = 0
- j = i
- counter = 1
- while j < amountOfElement:
- if counter % 2 == 0:
- summ += -arr[j]
- else:
- summ += arr[j]
- j += 1
- counter += 1
- best = max(summ, best)
- i += 1
- print(best)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement