Advertisement
serega1112

Easy Problem

Jan 21st, 2022
834
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n, x, y = map(int, input().split())
  2.  
  3. l = 0
  4. r = min(x, y) * n
  5.  
  6. while r - l > 1:
  7.     mid = l + (r - l) // 2
  8.     if 1 + (mid - min(x, y)) // x + (mid - min(x, y)) // y < n:
  9.         l = mid
  10.     else:
  11.         r = mid
  12.  
  13. print(r)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement