Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- sum = 0
- max_num = 0
- for i in range(n):
- num = int(input())
- sum += num
- if num > max_num:
- max_num = num
- result = sum - max_num
- if max_num == result:
- print('Yes')
- print(f'Sum = {max_num}')
- else:
- print('No')
- print(f'Diff = {abs(max_num - result)}')
- Pешение c list():
- n = int(input())
- numbers = list()
- for i in range(n):
- numbers.append(int(input()))
- if max(numbers) * 2 == sum(numbers):
- print(f'Yes\nSum = {max(numbers)}')
- else:
- print(f'No\nDiff = {abs(max(numbers) * 2 - sum(numbers))}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement