20250919 baekjoon

This commit is contained in:
songyc macbook 2025-09-19 15:46:57 +09:00
parent c7f5df57bd
commit 51d4b229f5

View File

@ -0,0 +1,27 @@
import java.util.Scanner;
public class _1002 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int result;
for(int i=0; i<N; i++) {
int x1 = sc.nextInt(); int y1 = sc.nextInt(); int r1 = sc.nextInt();
int x2 = sc.nextInt(); int y2 = sc.nextInt(); int r2 = sc.nextInt();
double dist = Math.sqrt(Math.pow(x1-x2,2) + Math.pow(y1-y2,2));
double subDist = Math.abs(r1-r2);
if (dist == 0 && r1 == r2) result = -1; // 원이 일치할
else if (dist == r1 + r2 || dist == subDist) result = 1; // 원이 외접 or 내접할
else if (r1 + r2 > dist && dist > subDist) result = 2;
else result = 0;
System.out.println(result);
}
sc.close();
}
}