-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1002_1.c
41 lines (37 loc) · 864 Bytes
/
1002_1.c
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
typedef struct
{
int x;
int y;
int r;
} Point;
int main(void)
{
int cnt, i = 0;
double dis;
Point jo, ba;
int arr[3];
scanf("%d", &cnt);
while(cnt--)
{
scanf("%d %d %d", &jo.x, &jo.y, &jo.r);
scanf("%d %d %d", &ba.x, &ba.y, &ba.r);
//dis = sqrt( (jo.x-ba.x)*(jo.x-ba.x) + (jo.y-ba.y)*(jo.y-ba.y) );
dis = sqrt( pow(jo.x-ba.x, 2) + pow(jo.y-ba.y, 2) );
if(!dis && jo.r == ba.r)
arr[i++] = -1;
else if(dis > (double)(jo.r+ba.r) || dis < (double)abs(jo.r-ba.r) )
arr[i++] = 0;
else if(dis == (double)(jo.r+ba.r) || dis == (double)abs(jo.r-ba.r))
arr[i++] = 1;
else
arr[i++] = 2;
}
for(i=0; i<3; i++)
printf("%d\n", arr[i]);
return 0;
}