Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package hop_qua;
- import java.util.Scanner;
- public class Hop_Qua {
- public static double Nghiem(double a, double b,double c)
- {
- double x1,x2;
- double dt=b*b-4*a*c;
- if(dt<0) return 0;
- else if(dt==0)
- {
- x1=-b/2/a;
- if(x1<0) return 0;
- else return x1;
- }else
- {
- x1=(-b+Math.sqrt(dt))/2/a;
- x2=(-b-Math.sqrt(dt))/2/a;
- if(x1<0||x2<0) return 0;
- else
- {
- if(x1<x2) return x1;
- else return x2;
- }
- }
- }
- public static void main(String[] args) {
- Scanner Sc=new Scanner(System.in);
- double x,y;
- x=Sc.nextDouble();
- y=Sc.nextDouble();
- double h=Nghiem(12, -4*(x+y), x*y);
- double v=4*h*h*h-2*(x+y)*h*h+x*y*h;
- System.out.println(""+v);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement