-
Notifications
You must be signed in to change notification settings - Fork 0
/
1015.py
26 lines (19 loc) · 862 Bytes
/
1015.py
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
# Leia os quatro valores correspondentes aos eixos x e y de dois pontos quaisquer no plano, p1(x1,y1) e p2(x2,y2) e
# calcule a distância entre eles, mostrando 4 casas decimais após a vírgula, segundo a fórmula:
# Distancia =
# Entrada
# O arquivo de entrada contém duas linhas de dados. A primeira linha contém dois valores de ponto flutuante: x1 y1
# e a segunda linha contém dois valores de ponto flutuante x2 y2.
# Saída
# Calcule e imprima o valor da distância segundo a fórmula fornecida, com 4 casas após o ponto decimal.
# Exemplo de Entrada Exemplo de Saída
# 1.0 7.0
# 5.0 9.0
# 4.4721
import math
linha1 = input().split(" ")
linha2 = input().split(" ")
x1,y1 = linha1
x2,y2 = linha2
distancia = math.sqrt(((float(x2) - float(x1))*(float(x2) - float(x1))) + ((float(y2)-float(y1)) *(float(y2)-float(y1))))
print("%0.4f" %distancia)