bl00dt3ars

08. Equal Pairs

Oct 30th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. n = int(input())
  2. sums = 0
  3. prev_sum = 0
  4. diff = 0
  5. max_diff = 0
  6.  
  7. for i in range(1, n+1):
  8.     sums += int(input())
  9.     sums += int(input())
  10.  
  11.     if i > 1:
  12.         diff = abs(sums - prev_sum)
  13.  
  14.     if diff > max_diff:
  15.         max_diff = diff
  16.     prev_sum = sums
  17.     sums = 0
  18.  
  19. if max_diff == 0:
  20.     print(f"Yes, value={prev_sum}")
  21. else:
  22.     print(f"No, maxdiff={max_diff}")
  23.    
  24.  
Add Comment
Please, Sign In to add comment