ural 1640 Circle of Winter
这道题真的很无聊,就是找一个圆,至少有一个点在这个圆上,其他点不能在圆外,半径不定;
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 #define maxn 3000 6 using namespace std; 7 8 struct node 9 { 10 int x,y; 11 }p[300]; 12 double sqr(double x) 13 { 14 return x*x; 15 } 16 bool vis[maxn]; 17 double dis(int x1,int y1,int x2,int y2) 18 { 19 return sqrt(sqr(x1-x2)+sqr(y1-y2)); 20 } 21 int main() 22 { 23 int n; 24 scanf("%d",&n); 25 memset(vis,false,sizeof(vis)); 26 for(int i=0; i<n; i++) 27 { 28 scanf("%d%d",&p[i].x,&p[i].y); 29 vis[p[i].x]=true; 30 } 31 int x,y; 32 for(int i=0; i<=maxn; i++) 33 { 34 if(!vis[i]) 35 { 36 x=i; 37 y=0; 38 break; 39 } 40 } 41 double max1=-1; 42 for(int i=0; i<n; i++) 43 { 44 max1=max(max1,dis(p[i].x,p[i].y,x,y)); 45 } 46 printf("%d %d %.9lf\n",x,y,max1); 47 return 0; 48 }