-
Notifications
You must be signed in to change notification settings - Fork 0
/
Problem72.java
45 lines (35 loc) · 1012 Bytes
/
Problem72.java
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
34
35
36
37
38
39
40
41
42
43
44
45
package dimikOJ;
import java.util.Scanner;
public class Problem72 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int N = input.nextInt();
while (N < 1) {
N = input.nextInt();
}
input.nextLine();
String[] inputs = new String[N];
for (int i = 0; i < N; i++) {
String temp = input.nextLine();
inputs[i] = temp.trim().replaceAll("\\s{2,}", " ");
}
input.close();
for (int i = 0; i < N; i++) {
String[] tempArray = inputs[i].split("\\s");
int a = Integer.parseInt(tempArray[0]);
int b = Integer.parseInt(tempArray[1]);
int c = Integer.parseInt(tempArray[2]);
area(a, b, c);
}
}
public static void area(int a, int b, int c) {
double s = (a + b + c) / 2;
double temp = s * (s - a) * (s - b) * (s - c);
if (temp < 0) {
System.out.println("Oh, No!");
} else if (temp >= 0) {
System.out.printf("%.2f\n", Math.sqrt(temp));
}
}
}