Cod sursa(job #655452)

Utilizator titeltitel popescu titel Data 2 ianuarie 2012 16:52:04
Problema Cele mai apropiate puncte din plan Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
// solutie de 40 puncte
#include<fstream>
#include<math.h>
#define nmax 100002
#define LL long long
using namespace std;
ifstream f("cmap.in"); ofstream g("cmap.out");
struct punct {LL x,y;} v[nmax];
int n;
LL d,dmin=0,mk[32];
LL dist(int p, int q)
{return (v[p].x-v[q].x)*(v[p].x-v[q].x)+(v[p].y-v[q].y)*(v[p].y-v[q].y);}

int main()
{	f>>n;	
	for(int i=1;i<=n;i++) f>>v[i].x>>v[i].y;
	for(int i=0; i<31; i++) dmin=dmin+(1<<i);
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++)
			{d=dist(i,j);
			 if(d<dmin) dmin=d;	
			}
	g.precision( 16 ); g<<sqrt((double)dmin)<<'\n';
	g.close(); return 0;
}