Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:我怎么WA了?这个公式不对么?

Posted by ccnu_xieshuo at 2008-05-06 20:04:05 on Problem 3587
In Reply To:我怎么WA了?这个公式不对么? Posted by:zgw at 2008-05-06 12:31:44
> #include <stdio.h>
> #include <math.h>
> 
> int n;
> double point[660][2];
> double dis[660][660];
> 
> int main()
> {
> 	int cas;
> 	int i, j, k;
> 	double ans, tmp;
> 	double a, b, c;
> 
> 	scanf("%d", &cas);
> 	while (cas-- > 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++)
> 				{
> 					a = dis[i][j];
> 					b = dis[i][k];
> 					c = dis[j][k];
> 					tmp = a*b*c/sqrt((a+b+c)*(a+b-c)*(a+c-b)*(b+c-a));
> 					if (tmp > ans)
> 					{
> 						ans = tmp;
> 					}
> 				}
> 			}
> 		}
> 		printf("%.3lf\n", ans);
> 	}
> 	return 0;
> }
公式是这样的 a*b*c/4*sqrt(s*(s-a)*(s-b)*(s-c))   s=1/2(a+b+c)

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator