BETA

Difficulty Level: Basic

Total Submissions: 847 Accuracy:

35.06%

Min value of x
     

Given 4 integers a,b,c and k . Find the min 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

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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