Codeforces Round 125 (Div. 2)
B
Special Olympics
Codeforces
1900
原题
← AC →
翻译中…

A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.

翻译中…

Let us remind you that a ring is a region located between two concentric circles with radii $*r*$ and $*R*$ $(*r* < *R*)$. These radii are called internal and external, respectively. Concentric circles are circles with centers located at the same point.

翻译中…

Soon a white canvas, which can be considered as an infinite Cartesian plane, had two perfect rings, painted with solid black paint. As Sasha is very impulsive, the rings could have different radii and sizes, they intersect and overlap with each other in any way. We know only one thing for sure: the centers of the pair of rings are not the same.

翻译中…

When Sasha got tired and fell into a deep sleep, a girl called Ilona came into the room and wanted to cut a circle for the sake of good memories. To make the circle beautiful, she decided to cut along the contour.

翻译中…

We'll consider a contour to be a continuous closed line through which there is transition from one color to another (see notes for clarification). If the contour takes the form of a circle, then the result will be cutting out a circle, which Iona wants.

翻译中…

But the girl's inquisitive mathematical mind does not rest: how many ways are there to cut a circle out of the canvas?

翻译中…

Input

翻译中…

The input contains two lines.

翻译中…

Each line has four space-separated integers $*x*_{*i*}$, $*y*_{*i*}$, $*r*_{*i*}$, $*R*_{*i*}$, that describe the $*i*$-th ring; $*x*_{*i*}$ and $*y*_{*i*}$ are coordinates of the ring's center, $*r*_{*i*}$ and $*R*_{*i*}$ are the internal and external radii of the ring correspondingly $( - 100 ≤ *x*_{*i*}, *y*_{*i*} ≤ 100; 1 ≤ *r*_{*i*} < *R*_{*i*} ≤ 100)$.

翻译中…

It is guaranteed that the centers of the rings do not coinside.

翻译中…

Output

翻译中…

A single integer — the number of ways to cut out a circle from the canvas.

翻译中…

Note

翻译中…

Figures for test samples are given below. The possible cuts are marked with red dotted line.

翻译中…

image image image

翻译中…

样例

Input #1
60 60 45 55
80 80 8 32
Output #1
1
InputCopy OutputCopy
Input #2
60 60 45 55
80 60 15 25
Output #2
4
InputCopy OutputCopy
Input #3
50 50 35 45
90 50 35 45
Output #3
0
InputCopy OutputCopy
题目信息
题号
199B
时间限制
2 s
内存限制
256 MB
标签
计算几何

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。