Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = int(input())
- left_sum = 0
- right_sum = 0
- for i in range(num):
- left_sum += int(input())
- for i in range(num):
- right_sum += int(input())
- if left_sum == right_sum:
- print(f'Yes, sum = {left_sum}')
- else:
- print(f'No, diff = {abs(left_sum - right_sum)}')
- РЕШЕНИЕ С ЕДИН FOR:
- num = int(input())
- left_sum = 0
- right_sum = 0
- for i in range(-num, num):
- if i < 0:
- left_sum += int(input())
- else:
- right_sum += int(input())
- if left_sum == right_sum:
- print(f'Yes, sum = {left_sum}')
- else:
- print(f'No, diff = {abs(left_sum - right_sum)}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement