티스토리 뷰
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int cnt = sc.nextInt();
double x1,y1,r1;
double x2,y2,r2;
double dist=0;
double r=0;
double dr=0;
int ret=0;
for(int i =0 ; i<cnt; i++){
ret=-99;
x1=sc.nextInt();
y1=sc.nextInt();
r1=sc.nextInt();
x2=sc.nextInt();
y2=sc.nextInt();
r2=sc.nextInt();
dist=Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
r= r1+r2;
dr= Math.abs(r1-r2);
if(dist==0){
if(r1==r2){ //1
ret=-1;
}
else{
ret=0;
}
}
else if(dist>r){
ret=0;
}
else if(dist==r){ //4
ret=1;
}
else if(dist==dr){ //3
ret=1;
}
else if(dist<dr){ //2
ret=0;
}
else {
ret =2 ;
}
if(ret==-99){
System.out.println("no data found");
}
else{
System.out.println(ret);
}
}
} // end of Main
} // end of class Main
'IT > JAVA' 카테고리의 다른 글
자바의 등장부터 현재까지 (0) | 2021.12.04 |
---|---|
프로그래밍 언어란? (0) | 2021.12.03 |
[java] 소수점 자르기 (0) | 2021.11.25 |
[JAVA] BufferedReader/BufferedWriter 간단 예제 (0) | 2021.06.22 |
ORACLE/JAVA/이전 버전 JDK설치/JDK1.6/JDK1.7/JDK1.8 (0) | 2019.12.23 |
댓글