Advertisement
serega1112

Ocenki

Jan 21st, 2022
1,002
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. twos = int(input())
  2. threes = int(input())
  3. fours = int(input())
  4.  
  5.  
  6. if 2 * (2 * twos + 3 * threes + 4 * fours) >= 7 * (twos + threes + fours):
  7.     print(0)
  8. else:
  9.     l = 0
  10.     r = twos + threes
  11.     while r - l > 1:
  12.         fives = l + (r - l) // 2
  13.         if 2 * (2 * twos + 3 * threes + 4 * fours + 5 * fives) < 7 * (twos + threes + fours + fives):
  14.             l = fives
  15.         else:
  16.             r = fives
  17.     print(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement