-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboj_1002.cpp
More file actions
37 lines (31 loc) · 911 Bytes
/
boj_1002.cpp
File metadata and controls
37 lines (31 loc) · 911 Bytes
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
29
30
31
32
33
34
35
36
37
//<1002>번 : <터렛>
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t, x1, x2, y1, y2, r1, r2;
cin >> t;
while(t--) {
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
int dx = abs(x2-x1);
int dy = abs(y2-y1);
int dist = dx*dx + dy*dy;
if(x1 == x2 && y1 == y2 && r1 == r2)
cout << -1 << '\n';
else if(r1*r1 > dist || r2*r2 > dist) {
int k = abs(r2-r1)*abs(r2 - r1);
if(k > dist) cout << 0 << '\n';
else if(k < dist) cout << 2 << '\n';
else if(k == dist) cout << 1 << '\n';
}
else {
int k = (r1 + r2) * (r1 + r2);
if(dist > k) cout << 0 << '\n';
else if(dist < k) cout << 2 << '\n';
else if(dist == k) cout << 1 << '\n';
}
}
return 0;
}