poj2253

//floyd
#include
#include
#include
#include
#include
using namespace std;
#define N 222
struct Point{int x,y;}P[N];
double f[N][N];
double sqr(int x){return x*x*1.0;}
double cal(int i,int j){return sqrt(sqr(P[i].x-P[j].x)+sqr(P[i].y-P[j].y));}
void init(int n)
{
	for(int i=1;i<=n;i++)cin>>P[i].x>>P[i].y;
	memset(f,0,sizeof(f));
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)f[i][j]=f[j][i]=cal(i,j);
}
void floyd(int n)
{
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				if(f[i][k]>n && n)
	{
		init(n);
		floyd(n);
		output(++cas);
	}
	return 0;
}

你可能感兴趣的:(ACM)