20250919 baekjoon
This commit is contained in:
parent
c7f5df57bd
commit
51d4b229f5
27
code_study/Baekjoon/java/_1002.java
Normal file
27
code_study/Baekjoon/java/_1002.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user