发一个最小圆的模板,顺便测试code

Post by zerob13

include <stdio.h> #include <math.h> #include<string.h> const int maxn = 501; const double eps = 1e-6; struct TPoint { double x, y; TPoint() { x=y=0; } TPoint operator-(TPoint &a) { TPoint p1; p1.x = x - a.x; p1.y = y - a.y; return p1; } }; struct TCircle { double r; TPoint centre; TCircle() { r=0; centre.x=centre.y=0; } }; struct TTriangle { TPoint t[3]; TTriangle() { int i; for(i=0;i c.r) { ce.t[tce] = a[i]; MinCircle(i - 1, tce + 1, ce); tmp = a[i]; for(j = i;j >= 2;j--) { a[j] = a[j - 1]; } a[1] = tmp; } } } void run(int n) { TTriangle ce; int i; MinCircle(n, 0, ce); printf("%.2lf\n", c.centre.x, c.centre.y, c.r);// 输出部分 } int main() { int n; while(scanf("%d", &n) != EOF && n) { for(int i = 1;i </string.h></math.h></stdio.h>