本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden]

1322. D. Circle Meets Square


Description

We all know that you can’t put a round peg in a square hole. Asking you to do so in this contest would be cruel and unusual punishment, which is banned by the Eighth Amendment to the United States Constitution. But, perhaps a more reasonable problem that the framers of the Constitution never thought about is determining if a given circle and square have an intersection of positive area (overlap), or touch (share a point in common), or don’t touch at all.
The framers of the US Constitution and the UCF Programming Team coaches would like to know, given a circle and a square, do the two overlap in some positive area, touch, or don’t touch at all. Help them out by writing a program to solve the problem!


The Problem:
Given the description of a square and circle in the Cartesian plane, determine if the intersection between the two has positive area (overlap), is a single point (touches) or doesn’t exist.

Input

The first line of input contains three integers: x (-1,000 ≤ x ≤ 1,000), y (-1,000 ≤ x ≤ 1,000), and r (0 < r ≤ 1,000), representing the x and y coordinates and radius, respectively of the circle.
The second line of input contains three integers: tx (-1,000 ≤ tx < 1,000), ty (-1,000 ≤ ty < 1,000), and s (0 < s ≤ 1,000), where (tx, ty) represents the coordinates of the bottom left corner of the square and s represents the side length of the square. The square’s top right corner is (tx+s, ty+s), so that its sides are parallel to the x and y axes.

Output

If the circle and square don’t touch, output 0 (zero). If they touch at a single point, output 1 (one). If they overlap in positive area, output 2 (two).

Samples

Input Copy
0 0 5
2 3 1
Output
2

Hint

Source

UCF2018
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 128MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 1 / 1
Tags:
Contests involved

1036. UCF 2018
My history solutions

You didn't submit any solution!
Submit your solution

Login Register