Advertisement
Apauldin

5

Oct 27th, 2021
1,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. X = int(input())
  2. Y = int(input())
  3.  
  4.  
  5. if X == 1:
  6.     print(1)
  7. else:
  8.     if Y == X:
  9.         print(-1)
  10.     else:
  11.         if Y - X == 1:
  12.             print(X * (X - 1))
  13.         else:
  14.             if (Y - X) > 1 and Y < 2 * X - 1:
  15.                 print(2 * X)
  16.             else:
  17.                 if Y >= 2 * X - 1:
  18.                     print(X)
  19.                 else:
  20.                     print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement