Sichanov

dede

Dec 6th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. n = int(input())
  2.  
  3. even_sum = 0
  4. odd_sum = 0
  5.  
  6. for i in range(0, n):
  7.     num = int(input())
  8.     if i % 2 == 0:
  9.         even_sum += num
  10.     else:
  11.         odd_sum += num
  12. if even_sum == odd_sum:
  13.  
  14.     print("Yes")
  15.     print(f"Sum = {even_sum}")
  16. else:
  17.     diff = abs(even_sum - odd_sum)
  18.     print("No")
  19.     print(f"Diff = {diff}")
  20.  
Advertisement
Add Comment
Please, Sign In to add comment