1. #include<iostream> 
  2. #include<algorithm> 
  3. #include<cmath> 
  4. using namespace std; 
  5.  
  6. static const int MAXNUM = 100000; 
  7.  
  8. struct Point{ 
  9.     double x,y; 
  10. }arrP[MAXNUM],arrX[MAXNUM],arrY[MAXNUM]; 
  11.  
  12. bool CompX(Point a, Point b) 
  13.     if(a.x == b.x) 
  14.         return a.y < b.y; 
  15.     return a.x < b.x; 
  16.  
  17. bool CompY(Point a, Point b) 
  18.     if(a.y == b.y) 
  19.         return a.x < b.x; 
  20.     return a.y < b.y; 
  21.  
  22. double GetDistance(Point a, Point b) 
  23.     return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y,2.0)); 
  24.  
  25. double MinDistance(double a, double b) 
  26.     return a<=b? a: b; 
  27.  
  28. double GetMinDistabce(int l, int r) 
  29.     if(l == r) 
  30.         return 0; 
  31.     else if(l+1 == r) 
  32.         return GetDistance(arrP[l], arrP[r]); 
  33.     else if(l+2 == r){ 
  34.         double tmp1 = GetDistance(arrP[l],arrP[l+1]); 
  35.         double tmp2 = GetDistance(arrP[l],arrP[r]); 
  36.         double tmp3 = GetDistance(arrP[l+1],arrP[r]); 
  37.         return MinDistance(MinDistance(tmp1,tmp2),tmp3); 
  38.     } 
  39.  
  40.  
  41.     int middle=(l+r)/2,j=0,k=0; 
  42.  
  43.     double minDistance = MinDistance(GetMinDistabce(l,middle),GetMinDistabce(middle+1,r)); 
  44.     for(int i=l;i<=r;i++){ 
  45.         if(fabs(arrP[i].x - arrP[middle].x) < minDistance) 
  46.             arrX[j++] = arrP[i];//arrX[]存储的是x坐标距离小于当前最小距离的点 
  47.     } 
  48.     sort(arrX,arrX+j,CompY); 
  49.     middle = (j+1)/2; 
  50.     for(int i = 0;i < j; i++){ 
  51.         if(fabs(arrX[i].y - arrX[middle].y) < minDistance) 
  52.             arrY[k++]=arrX[i];//arrY[]存储的是x坐标距离小于当前最小距离的点,且Y坐标距离也小于当前最小点的点 
  53.     } 
  54.     for(int i=0; i<k; i++){//遍历arrY数组,两两计算点之间距离 
  55.         for(int j=i+1; j<k; j++){ 
  56.             double tmpDistance = GetDistance(arrY[i],arrY[j]); 
  57.             if(tmpDistance < minDistance) 
  58.                 minDistance = tmpDistance; 
  59.         } 
  60.     } 
  61.     return minDistance; 
  62.  
  63. int main() 
  64.     int n; 
  65.     while(cin>>n && n!=0){ 
  66.         //Point p; 
  67.         double minDistance; 
  68.         for(int i=0; i<n; i++){ 
  69.             cin >> arrP[i].x >> arrP[i].y; 
  70.         } 
  71.         sort(arrP,arrP+n,CompX); 
  72.         minDistance = GetMinDistabce(0,n-1); 
  73.         cout.precision(2); 
  74.         cout << fixed << minDistance/2<<endl; 
  75.     } 
  76.     return 0;