반내림이 안되었다고 하셔서 말씀해주신대로 Math.floor 써봤는데 이렇게 쓰는게 아닌가요....? 자꾸 WA가 뜹니다 ㅠ
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double a = input.nextDouble();
double b = input.nextDouble();
double c = input.nextDouble();
double pan = Math.pow(b, 2) - 4 * a * c;
double method = (Math.sqrt(pan));
if (pan > 0) {
double answer1 = (-b + method) / 2 * a;
double answer2 = (-b - method) / 2 * a;
double answer3 = (answer1 > answer2) ? answer1 : answer2 ;
double answer4 = Math.floor(answer3*10)/10.0;
System.out.printf("%.1f\n", answer4);
}
if (pan == 0) {
double answer = -b*10/2*a;
double last = Math.floor(answer*10)/10.0;
System.out.printf("%.1f\n", last);
}
if (pan < 0) {
System.out.print("complex");
}
}
}