Bài 25:
from math import sqrt
from math import pow
def distance_points(ax, ay, bx, by):
return sqrt(pow(bx - ax, 2) + pow(by - ay, 2))
mx = int(input ("Nhap mx: "))
my = int(input ("Nhap my: "))
ix = int(input ("Nhap ix: "))
iy = int(input ("Nhap iy: "))
r = int(input ("Nhap r: "))
d = distance_points(mx, my, ix, iy)
if d < r:
print("M nam trong duong tron")
elif d==r:
print("M nam trong duong tron")
else:
print("M nam trong duong tron")
Bộ test:
mx=2
my=4
ix=3
iy=7
r=6
Kết quả:
M nằm trong đường tròn