Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Circles Intersection

You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$.

Write a program which prints:

"2" if $B$ is in $A$,

"-2" if $A$ is in $B$,

"1" if circumference of $A$ and $B$ intersect, and

"0" if $A$ and $B$ do not overlap.

You may assume that $A$ and $B$ are not identical.

Input

The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:

$x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$

Output

For each dataset, print 2, -2, 1, or 0 in a line.

Sample Input

2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 2.0 4.1 0.0 2.0

Output for the Sample Input

2
0

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Volume0_0023
{
    class Program
    {
        static void Main(string[] args)
        {
            int dataNum = int.Parse(Console.ReadLine());
            var inputs = new Queue<string>();

            for (int i = 0; i < dataNum; i++)
            {
                inputs.Enqueue(Console.ReadLine());
            }

            foreach (var input in inputs)
            {
                var dataset = input.Split(' ').Select(double.Parse).ToArray();
                Circle c1, c2;
                c1 = new Circle(new Vector2(dataset[0], dataset[1]), dataset[2]);
                c2 = new Circle(new Vector2(dataset[3], dataset[4]), dataset[5]);

                Console.WriteLine((int)Circle.GetCondition(c1, c2));
            }
        }
    }

    struct Vector2
    {
        public double X, Y;

        public Vector2(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }

        public static Vector2 Add(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X + v2.X, v1.Y + v2.Y);
        }


        public static Vector2 operator +(Vector2 v1, Vector2 v2)
        {
            return Add(v1, v2);
        }


        public static Vector2 Subtract(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X - v2.X, v1.Y - v2.Y);
        }

        public static Vector2 operator -(Vector2 v1, Vector2 v2)
        {
            return Subtract(v1, v2);
        }

        public static Vector2 Multiply(double x, Vector2 v)
        {
            return new Vector2(x * v.X, x * v.Y);
        }

        public static Vector2 operator *(double x, Vector2 v)
        {
            return Multiply(x, v);
        }

        public static Vector2 Divide(Vector2 v, double x)
        {
            return new Vector2(v.X / x, v.Y / x);
        }

        public static Vector2 operator /(Vector2 v, double x)
        {
            return Divide(v, x);
        }

        public static double Dot(Vector2 v1, Vector2 v2)
        {
            return v1.X * v2.X + v1.Y + v2.Y;
        }

        public static double Cross(Vector2 v1, Vector2 v2)
        {
            return v1.X * v2.Y - v1.Y * v2.X;
        }

        public static Vector2 Negate(Vector2 v)
        {
            return new Vector2(-v.X, -v.Y);
        }

        public static Vector2 operator -(Vector2 v)
        {
            return Negate(v);
        }

        public double Length()
        {
            return Math.Sqrt(X * X + Y * Y);
        }

        public double LengthSquared()
        {
            return X * X + Y * Y;
        }
    }

    struct Circle
    {
        public Vector2 Point;
        public double R;

        public Circle(Vector2 point, double r)
        {
            this.Point = point;
            this.R = r;
        }

        public static CircleCondition GetCondition(Circle a, Circle b)
        {
            double distance = (a.Point - b.Point).Length();

            if (distance + b.R < a.R)
            {
                return CircleCondition.BInsideA;
            }
            else if (distance + a.R < b.R)
            {
                return CircleCondition.AInsideB;
            }
            else if (distance <= a.R + b.R)
            {
                return CircleCondition.Cross;
            }
            else
            {
                return CircleCondition.Outside;
            }
        }
    }

    enum CircleCondition
    {
        BInsideA = 2,
        AInsideB = -2,
        Cross = 1,
        Outside = 0
    }
}