-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeecrowd1036.java
More file actions
33 lines (26 loc) · 1000 Bytes
/
Beecrowd1036.java
File metadata and controls
33 lines (26 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package beecrowd1036;
import java.util.Locale;
import java.util.Scanner;
public class Beecrowd1036 {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
sc.close();
String[] valores = input.split(" ");
double a = Double.parseDouble(valores[0]);
double b = Double.parseDouble(valores[1]);
double c = Double.parseDouble(valores[2]);
double raiz1 = 0.0;
double raiz2 = 0.0;
double delta = (b * b) - (4 * (a) * (c));
if((delta > -1) && (a != 0)) {
raiz1 = (-(b) + Math.sqrt(delta)) / (2 * (a));
raiz2 = (-(b) - Math.sqrt(delta)) / (2 * (a));
System.out.printf("R1 = %.5f%n", raiz1);
System.out.printf("R2 = %.5f%n", raiz2);
}else {
System.out.println("Impossivel calcular");
};
}
}