-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00004.cpp
More file actions
40 lines (34 loc) · 798 Bytes
/
00004.cpp
File metadata and controls
40 lines (34 loc) · 798 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
// Problem: Eolymp 4 - Two circles
// Link: https://basecamp.eolymp.com/en/problems/4
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double x1,x2,y1,y2,r1,r2,radius,mesafe;
cin>>x1>>y1>>r1;
cin>>x2>>y2>>r2;
mesafe=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
radius=(r1+r2)*(r1+r2);
double radius1=(r1-r2)*(r1-r2);
double ferq=0.001;
if(x1==x2 && y1==y2 && r1==r2){
cout<<-1<<endl;
}
else if(fabs(mesafe-radius)<ferq){
cout<<1<<endl;
}
else if(fabs(mesafe-radius1)<ferq){
cout<<1<<endl;
}
else if(mesafe>radius){
cout<<0<<endl;
}
else if(mesafe<radius1){
cout<<0<<endl;
}
else{
cout<<2<<endl;
}
}