← Back to List

29736번: 브실이와 친구가 되고 싶어 🤸‍♀️ ↗

Solutions

Python 3
168 B | 168 chars
a, b = map(int, input().split())
k, x = map(int, input().split())
l = k - x
r = k + x

if r < a or b < l:
  print("IMPOSSIBLE")
else:
  print(min(b, r) - max(a, l) + 1)