P15327 [GeeksforGeeks] Min value of x2252
普及-
题目描述

Given 4 integers a,b,c and k . Find the min(non-negative Integral) value of x such that ax^{2}+bx+c >= k.
Example 1:
Input: a = 4, b = 6, c = 5, k = 5
Output: 0
Explanation: 4(0)^{2}+60+5 = 5 which is

= 5.
​Example 2:
Input: a = 1, b = 2, c = 3, k = 4
Output: 1
Explanation: 1(1)^{2}+21+3 = 6 which is
​>= 4.
Your Task:
You don't need to read input or print anything. Your task is to complete the function minX() which takes a, b, c and k as inputs and returns the answer.
Expected Time Complexity: O(log k)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ a, b, c ≤ 10^{5}
1 ≤ k ≤ 10^{9}

输入格式

见题面

输出格式

见题面

样例输入
a = 4, b = 6, c = 5, k = 5
样例输出
0