1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#include <iostream> #include <cmath> #include <cstdio> #include <algorithm> #define MAXD 998998998998 using namespace std; struct point{ double x,y; }p[100005]; bool cmp(point a,point b){ return a.x<b.x; } int main(){ int n = 0; while (cin >> n && n){ for (int i = 1;i <= n;i++){ cin >> p[i].x >> p[i].y; } sort(p+1,p+1+n,cmp); double res = MAXD; for (int i = 1;i <= n;i++){ for (int j = i+1;j <= n;j++){ res = min(sqrt((p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y))/2,res); } } printf("%.2lfn",res); } return 0; } |
这个题略邪乎,数据好像不对。
January 06, 2015
you are really a ACM dashener.