Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
不理解为啥就是不对呢 求好心人指证#include <stdio.h> #include <math.h> const double esp=1e-9; int n; double point[660][2]; double dis[660][660]; int main() { int n; int i, j, k; double ans, temp; double a, b, c; double p; scanf("%d", &n); while (n--> 0) { scanf("%d", &n); ans = 0.0; for (i = 0; i < n; i++) { scanf("%lf%lf", &point[i][0], &point[i][1]); } for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { dis[i][j] = sqrt((point[i][0]-point[j][0])*(point[i][0]-point[j][0])+(point[i][1]-point[j][1])*(point[i][1]-point[j][1])); } } for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k < n; k++) { if(dis[i][j]<=esp||dis[i][k]<=esp||dis[j][k]<=esp)break; if(fabs(dis[i][j]+dis[i][k]-dis[j][k])<esp)break; if(fabs(dis[i][j]+dis[j][k]-dis[i][k])<esp)break; if(fabs(dis[j][k]+dis[i][k]-dis[i][j])<esp)break; a = dis[i][j]; b = dis[i][k]; c = dis[j][k]; p = (a+b+c)/2; temp = a*b*c/4/sqrt(p*(p-c)*(p-b)*(p-a)); if (temp > ans) { ans = temp; } } } } printf("%.3lf\n", ans); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator