水题,只需求出最远距离的两个点即可。中点就是圆心,题目:
Buried memory
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1191 Accepted Submission(s): 626
The world king Sconbin is not the exception.One day,Sconbin was sleeping,then swakened by one nightmare.It turned out that his love letters to Dufein were made public in his dream.These foolish letters might ruin his throne.Sconbin decided to destroy the letters by the military exercises's opportunity.The missile is the best weapon.Considered the execution of the missile,Sconbin chose to use one missile with the minimum destruction.
Sconbin had writen N letters to Dufein, she buried these letters on different places.Sconbin got the places by difficult,he wants to know where is the best place launch the missile,and the smallest radius of the burst area. Let's help Sconbin to get the award.
3 1.00 1.00 2.00 2.00 3.00 3.00 0
2.00 2.00 1.41
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define M 505
struct point{
double x,y;
}pp[M];
int main(){
int n;
while(scanf("%d",&n),n){
for(int i=1;i<=n;++i)
scanf("%lf%lf",&pp[i].x,&pp[i].y);
double mm=0,len,xs=0,ys=0,xe=0,ye=0;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i==j)
continue;
len=sqrt((pp[j].x-pp[i].x)*(pp[j].x-pp[i].x)+(pp[j].y-pp[i].y)*(pp[j].y-pp[i].y));
if(mm<len){
mm=len;
xs=pp[i].x;ys=pp[i].y;xe=pp[j].x;ye=pp[j].y;
}
}
}
printf("%.2lf %.2lf %.2lf\n",(xe+xs)/2,(ye+ys)/2,mm/2);
}
return 0;
}
8003




被折叠的 条评论
为什么被折叠?



