Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- rsync
- oracle
- 오블완
- 명령어
- JPA
- 트랜잭션
- spring
- 자바
- 티스토리챌린지
- 차이점
- git
- MariaDB
- group by
- analytics4
- mssql
- Linux
- top
- java
- SQL
- mysql
- PostgreSQL
- DBMS
- 리눅스
- network
- Javascript
- Python
- docker
- MongoDB
- IntelliJ
- API
Archives
- Today
- Total
hanker
백준(1002) JAVA - 터렛 본문
반응형
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
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();
int v = (int)(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
double plusR = Math.pow(r1 + r2, 2);
double minusR = Math.pow(r2 - r1, 2);
if(x1 == x2 && y1 == y2 && r1 == r2){
System.out.println(-1);
} else if(v > plusR || v < minusR) {
System.out.println(0);
} else if(v == minusR || v == plusR) {
System.out.println(1);
} else {
System.out.println(2);
}
}
}
}
반응형
'Study > ALGORITHM' 카테고리의 다른 글
백준(10870) JAVA - 피보나치 수 5 (0) | 2021.08.17 |
---|---|
백준(10872) JAVA - 팩토리얼 (0) | 2021.07.09 |
백준(3053) JAVA - 택시 기하학 (0) | 2021.07.07 |
백준(4153) JAVA - 직각삼각형 (0) | 2021.06.29 |
백준(3009) JAVA - 네 번째 점 (0) | 2021.06.29 |