-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1002.cpp
More file actions
49 lines (46 loc) · 723 Bytes
/
1002.cpp
File metadata and controls
49 lines (46 loc) · 723 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
38
39
40
41
42
43
44
45
46
47
48
49
// 1002. 터렛
// 2019.05.14
// 기하 알고리즘
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int t, x1, y1, r1, x2, y2, r2;
cin >> t;
while (t > 0)
{
t--;
cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
//두 중심사이의 거리 계산(공식)
double dist = sqrt(pow(x1 - x2, 2.0f) + pow(y1 - y2, 2.0f));
if (dist == 0)
{
if (r1 == r2)
{
cout << -1 << endl;
}
else
{
cout << 0 << endl;
}
}
else
{
if ((r1 + r2) > dist && abs(r1 - r2) < dist)
{
cout << 2 << endl;
}
else if ((r1 + r2) == dist || abs(r1 - r2) == dist)
{
cout << 1 << endl;
}
else
{
cout << 0 << endl;
}
}
}
return 0;
}