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

貌似没问题,我也这么做的,AC了

Posted by bjiang at 2008-06-13 15:23:05 on Problem 1385
In Reply To:为什么是WA呢?难道精度有问题?算法是参照佳佳书上的。。。 Posted by:kef at 2006-04-14 00:28:06
> #include<stdio.h>
> 
> int xi,yi,xj,yj,x1,y1;
> __int64 cx,cy,area;
> 
> int main()
> {
> 	int t,n,i;
> 	scanf("%d",&t);
> 	while(t--) {
> 		area=0;
> 		cx=cy=0;
> 
> 		scanf("%d",&n);
> 		scanf("%d%d",&x1,&y1);
> 		xi=x1; yi=y1;
> 
> 		for(i=1;i<n;i++) {
> 			scanf("%d%d",&xj,&yj);
> 			area+=xi*yj-yi*xj;
> 			cx+=(xi+xj)*(xi*yj-yi*xj);
> 			cy+=(yi+yj)*(xi*yj-yi*xj);
> 			xi=xj; yi=yj;
> 		}
> 		area+=xi*y1-yi*x1;
> 		cx+=(xi+x1)*(xi*y1-yi*x1);
> 		cy+=(yi+y1)*(xi*y1-yi*x1);
> 
> 		printf("%.2lf %.2lf\n",cx/3.0/area,cy/3.0/area);
> 	}
> 	return 0;
> }

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