Min value of x
Submissions: 983   Accuracy:

37.44%

  Difficulty: Basic   Marks: 1

Given 4 integers a,b,c and k . Find the min(non-negative Integral) value of x such that ax2+bx+c >= k.

INPUT:
The first line contains a single integer T i.e. the number of test cases. The first and the only line in each test case consists of four integers a,b,c and k

OUTPUT: 
Print the min value of the x so that the answer from the equation is atleast equal to k.

CONSTRAINTS:
1<=T<=100
1<= a,b,c <=105
1<=k<=109

EXAMPLES:
INPUT:

2
4 6 5 5
1 2 3 4

OUTPUT:
0
1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.