import java.io.*; public class kuup{ public static void main(String argumendid[]) throws IOException{ BufferedReader klaviatuur=new BufferedReader( new InputStreamReader(System.in) ); double a=2, b=-4, c=-22, d=24; int saba=-100; double i, j, K, L, M, N, P, R, S, T, U; double x1=0, x2=0, x3=0; double f=((3.0*c/a)-(b*b)/(a*a))/3.0; double g = ( (2.0*Math.pow(b, 3)/Math.pow(a, 3)) - (9.0*b*c/Math.pow(a, 2)) + (27.0*d/a) )/27.0; double h = (Math.pow(g, 2)/4.0) + (Math.pow(f, 3)/27.0); System.out.println("f="+f); System.out.println("g="+g); System.out.println("h="+h); if(h <= 0){ i=Math.sqrt(((g*g)/4)-h); j=Math.pow(i, (1.0/3)); K=Math.acos(-1*(g / (2*i))); L=(j * -1); M=Math.cos(K/3); N=(Math.sqrt (3)) * Math.sin(K/3); P=((b/(3*a)) * -1); x1=(2*j) * (Math.cos(K/3))-(b/(3*a)); x2=(L*(M+N))+P; x3=(L*(M-N))+P; System.out.println("i="+i); System.out.println("j="+j); System.out.println("K="+K); System.out.println("L="+L); System.out.println("M="+M); System.out.println("N="+N); System.out.println("P="+P); } if (h>0){ f=((3*c/a)-((b*b)/(a*a)))/3; g=((2.0*Math.pow(b, 3)/Math.pow(a, 3))-(9.0*b*c/Math.pow(a, 2))+(27.0*d/a))/27.0; h=(Math.pow(g, 2)/4.0)+(Math.pow(f, 3)/27.0); R=-1*(g/2.0)+Math.pow(h, (1.0/2.0)); S=Math.pow(R, (1.0/3.0)); T=-1*(g/2.0)-Math.pow(h, (1.0/2.0)); T=T*-1.0; U=Math.pow(T, (1.0/3.0)); U=U*-1.0; x1=(S+U)-(b/(3*a)); x2=-1.0*((S+U)/2.0)-(b/(3*a)); x3=-1.0*((S+U)/2.0)-(b/(3*a)); System.out.println("f="+f); System.out.println("g="+g); System.out.println("h="+h); System.out.println("R="+R); System.out.println("S="+S); System.out.println("T="+T); System.out.println("U="+U); } if(h==0 && g==0 && f==0){ x1=Math.pow((d/a), (1.0/3))*-1; x2=Math.pow((d/a), (1.0/3))*-1; x3=Math.pow((d/a), (1.0/3))*-1; } System.out.println(a+" "+b+" "+c+" "+d); System.out.println("x1="+x1); System.out.println("x2="+x2); System.out.println("x3="+x3); } }