반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <iostream>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
int main(void) {
double x1, y1, r1, x2, y2, r2;
double d;
int C;
cin >> C;
while(C--) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
d = sqrt(pow(x2-x1, 2) + pow((y2-y1),2));
//cout << max(r1,r2)-min(r1,r2) << " " << d << " " << r1+r2 << endl;
if(x1==x2 && y1==y2 && r1==r2) cout << -1 << endl;
else if(max(r1,r2)-min(r1,r2) < d && d < r1+r2) cout << 2 << endl;
else if(d==(r1 + r2) || d==(max(r1,r2)-min(r1,r2))) cout << 1 << endl;
else if(r1+r2<d || d<max(r1,r2)-min(r1,r2) || d==0) cout << 0 << endl;
}
return 0;
}
|
cs |
반응형
'category > 백준 알고리즘 c++' 카테고리의 다른 글
백준 알고리즘 1920번 수 찾기 (0) | 2023.02.14 |
---|---|
백준 알고리즘 7576번 토마토 (0) | 2023.02.14 |
백준 알고리즘 2447번 별찍기 - 10 (0) | 2023.02.14 |
백준 알고리즘 24479번 알고리즘 수업 - 깊이 우선 탐색 1 (0) | 2023.02.14 |
백준 알고리즘 4344번 평균은 넘겠지 c++ (0) | 2021.01.20 |
백준 알고리즘 8958번 OX퀴즈 c++ (0) | 2021.01.20 |
백준 알고리즘 1546번 평균 c++ (0) | 2020.12.13 |
백준 알고리즘 3052번 나머지 c++ (0) | 2020.12.13 |
댓글