Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Main {
- public static void main(String[] args) throws NumberFormatException, IOException {
- BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
- int t=Integer.parseInt(r.readLine());
- while(t-->0)
- {
- String[] s=r.readLine().split(" ");
- long a=Integer.parseInt(s[0]);
- long b=Integer.parseInt(s[1]);
- long c=Integer.parseInt(s[2]);
- if(b<=0){System.out.println("No Roots");}
- else{
- double d=(b*b)-(4*a*c);
- if(d<0 ) {System.out.println("No Roots");}
- else{
- d=Math.sqrt(d);
- System.out.println(""+((b*-1)+d)/(2*a));
- System.out.println(""+((b*-1)-d)/(2*a));
- }
- }}
- }
- }
Add Comment
Please, Sign In to add comment