-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeecrowd1043.java
More file actions
30 lines (23 loc) · 1000 Bytes
/
Beecrowd1043.java
File metadata and controls
30 lines (23 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Beecrowd1043 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] valores = br.readLine().split(" ");
float[] ladosTriangulo = new float[valores.length];
for(int i = 0; i < valores.length; i++) {
ladosTriangulo[i] = Float.parseFloat(valores[i]);
}
float a = ladosTriangulo[0];
float b = ladosTriangulo[1];
float c = ladosTriangulo[2];
if((a + b) > c && (b + c) > a && (c + a) > b) {
float perimetro = a + b + c;
System.out.printf("Perimetro = %.1f%n", perimetro);
} else {
float areaTrapezioABC = ((a + b) * c) / 2;
System.out.printf("Area = %.1f%n", areaTrapezioABC);
}
}
}