Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- amountOfStones = int(input())
- stones = [int(i) for i in input().split()]
- stones.sort(reverse=True)
- first = [stones[0]]
- second = []
- i = 1
- while i < len(stones):
- if sum(first) > sum(second):
- second.append(stones[i])
- else:
- first.append(stones[i])
- i += 1
- print(abs(sum(first) - sum(second)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement