#C7515. Circles Intersection
Circles Intersection
Circles Intersection
Given two circles defined by their centers and radii, determine whether the circles intersect or at least touch each other.
Let the first circle have center \((x_1, y_1)\) and radius \(r_1\), and the second circle have center \((x_2, y_2)\) and radius \(r_2\). The distance between the centers is computed by the formula:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
The circles intersect or touch if \(d \leq r_1 + r_2\). Your task is to read the input values and output YES
if the circles intersect or touch, and NO
otherwise.
inputFormat
A single line contains six space-separated integers: x1, y1, r1, x2, y2, r2.
outputFormat
Output a single line containing either YES or NO depending on whether the circles intersect or touch.## sample
0 0 5 5 0 5
YES