Advertisement
HuanMatus

Untitled

Jan 30th, 2022
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement