思路:
1.求三角形外切圆2.求出 圆点与半径,再判断给出的点是否在圆内
知识点:
1.已知三点求外接圆圆心: rx=(x1+x2+x3)/3,ry=(y1+y2+y3)/3
/*Code By Aquariuslt*/
/*HDU 4720 Naive and Silly Muggles*/
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<string.h>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<limits.h>
#include<math.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORD(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define CLR(a) memset(a,0,sizeof(a))
using namespace std;
#define maxn 10001
int main(){
int t;
scanf("%d",&t);
REP(ti,t){
double x1,x2,x3,y1,y2,y3;
double lx,ly,rx,ry;
scanf("%lf %lf",&x1,&y1);
scanf("%lf %lf",&x2,&y2);
scanf("%lf %lf",&x3,&y3);
scanf("%lf %lf",&lx,&ly);
rx=(x1+x2+x3)/3.0;
ry=(y1+y2+y3)/3.0;
double r=sqrt((rx-x1)*(rx-x1)+(ry-y1)*(ry-y1));
double leng=sqrt((rx-lx)*(rx-lx)+(ry-ly)*(ry-ly));
if(r>=leng)printf("Case #%d: Danger\n",ti+1);
else printf("Case #%d: Safe\n",ti+1);
}
return 0;
}