以四个顶点为圆心画圆,圆面积不能重合,求四个圆的直径和最大是多少。
#define _CRT_SECURE_NO_WARNINGS #include<string.h> #include<stdio.h> #include<math.h> #include<algorithm> using namespace std; double minn(double a,double b,double c) { a=a<b? a:b; a=a<c? a:c; return a; } int main() { double x[10],y[10],l[10]; while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3])!=EOF) { l[0]=(x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]); l[1]=(x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]); l[2]=(x[0]-x[3])*(x[0]-x[3])+(y[0]-y[3])*(y[0]-y[3]); l[3]=(x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2]); l[4]=(x[1]-x[3])*(x[1]-x[3])+(y[1]-y[3])*(y[1]-y[3]); l[5]=(x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3]); printf("%.8lf ",minn(sqrt(l[0])+sqrt(l[5]),sqrt(l[1])+sqrt(l[4]),sqrt(l[2])+sqrt(l[3]))); } return 0; }