Circle Meets Square
InterviewTime limit1sMemory limit1024 MB
Given a circle and an axis-aligned square, determine whether they overlap in positive area, touch at a single point, or do not meet.
Problem
We all know that a round peg cannot fit into a square hole. Asking you to do so in this contest would be cruel and unusual punishment, which the Eighth Amendment to the United States Constitution bans. A more reasonable problem, one the Framers probably never considered, is determining whether a given circle and square overlap in a region of positive area, touch at a single point, or do not touch at all.
The Framers of the US Constitution and the UCF Programming Team coaches want to know, for a given circle and square, whether the two overlap in positive area, touch, or do not touch at all. Write a program that helps them.
Given the description of a square and a circle in the Cartesian plane, determine whether their intersection has positive area (overlap), is a single point (touch), or does not exist.
Input
The first line contains three integers x, y, and r, the x and y coordinates and the radius of the circle. , , and .
The second line contains three integers tx, ty, and s, where (tx, ty) is the bottom left corner of the square and s is its side length. , , and . The top right corner is (tx+s, ty+s), and the sides are parallel to the x and y axes.
Output
Print 0 if the circle and square do not touch. Print 1 if they touch at a single point. Print 2 if they overlap in positive area.
Hint
Pictures of the sample inputs


