URI Online Judge | 1043
Triângulo
Adaptado por Neilor Tonin, URI
Brasil
Timelimit: 1
Brasil
Leia 3 valores reais (A, B e C) e verifique se eles formam ou não um triângulo. Em caso positivo, calcule o perímetro do triângulo e apresente a mensagem:
Perimetro = XX.X
Em caso negativo, calcule a área do trapézio que tem A e B como base e C como altura, mostrando a mensagem
Area = XX.X
Entrada
A entrada contém três valores reais.
Saída
O resultado deve ser apresentado com uma casa decimal.
URI Online Judge | 1043
Triangle
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Brazil
Read three point floating values (A, B and C) and verify if is possible to make a triangle with them. If it is possible, calculate the perimeter of the triangle and print the message:
Perimetro = XX.X
If it is not possible, calculate the area of the trapezium which basis A and B and C as height, and print the message:
Area = XX.X
Input
The input file has tree floating point numbers.
Output
Print the result with one digit after the decimal point.
a, b, c =x
a = float(a)
b = float(b)
c = float(c)
if abs(b - c) < a < (b + c) and (a - c) < b < (a + c) and (a - b) < c < (a + b):
print('Perimetro = {:.1f}'.format(a + b + c))
else:
print('Area = {:.1f}'.format(((a + b) / 2) * c))
Nenhum comentário:
Postar um comentário