Advertisement
HuanMatus

Untitled

Jan 22nd, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. difference = list()
  2. summa = 0
  3. for i in range(int(input())):
  4. a, b = map(int, input().split())
  5. if a < b:
  6. summa += a
  7. else:
  8. summa += b
  9. difference.append(abs(a-b))
  10. print(f'summa = {summa}')
  11. to_add_for_end_is_7 = 7 - summa % 10
  12. print(f'need to add something that ends with {to_add_for_end_is_7}')
  13. difference.sort()
  14. for i in difference:
  15. if i % 10 == to_add_for_end_is_7:
  16. print(f'can add {i}')
  17. print('otvet = ', summa + i) # file a and b answers 8317 19596697
  18. break
  19.  
  20. ''''
  21. 5
  22. 1 3
  23. 5 11
  24. 6 9
  25. 5 4
  26. 5 7
  27. '''
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement