Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- total = int(input())
- first = int(input())
- if not total:
- print(0)
- elif total <= first:
- print(1)
- else:
- l = 1
- r = total + 1
- while r - l > 1:
- mid = l + (r - l) // 2
- summ = 0.5 * mid * (mid - 1) + mid * first
- if summ < total:
- l = mid
- else:
- r = mid
- print(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement