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:我觉得这样看着更好些 该上面的代码

Posted by Deathfuture at 2011-06-15 23:27:18 on Problem 2242
In Reply To:给出公式! 不需要解析几何! Posted by:810974380 at 2009-08-03 15:46:30
#include<stdio.h>
#include<math.h>
#define pi 3.141592653589793

main()
{
	double x1, y1, x2, y2, x3, y3, a, b, c, s, d, p;

	while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
	{
		a = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
		b = sqrt((x3-x1)*(x3-x1) + (y3-y1)*(y3-y1));
		c = sqrt((x3-x2)*(x3-x2) + (y3-y2)*(y3-y2));
		p = (a+b+c)/2;
		s = sqrt(p*(p-a)*(p-b)*(p-c));
		d = a*b*c/s;
		printf("%.2lf\n",d*pi/2);
	}
}

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