Created
December 5, 2011 16:43
-
-
Save mojaie/1434245 to your computer and use it in GitHub Desktop.
AOJ:0023
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn = new Scanner(System.in); | |
int n = scn.nextInt(); | |
for (int i = 0; i < n; i++) { | |
double xa = scn.nextDouble(); | |
double ya = scn.nextDouble(); | |
double ra = scn.nextDouble(); | |
double xb = scn.nextDouble(); | |
double yb = scn.nextDouble(); | |
double rb = scn.nextDouble(); | |
double d = Math.sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya)); | |
if (d > ra + rb) { | |
System.out.println(0); | |
} else { | |
if (d + ra < rb) { | |
System.out.println(-2); | |
} else if (d + rb < ra) { | |
System.out.println(2); | |
} else { | |
System.out.println(1); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment