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

哎,wa了好多次,改提交c++就过了,高人帮我看看为什么

Posted by TSERROF at 2012-08-14 11:40:17 on Problem 2365
#include <cstdio>
#include <cmath>
#define PI 3.141592653589
int main()
{
	double N;
    double radius;
	while(scanf("%lf%lf",&N,&radius)!=EOF)
	{
		double x,y,topx,topy;
		scanf("%lf%lf",&topx,&topy);
		x=topx,y=topy;
		double ans=2*PI*radius;
		for (int i=1;i<N;++i)
		{
			double a,b;
			scanf("%lf%lf",&a,&b);
			ans+=sqrt((a-x)*(a-x)+(b-y)*(b-y));
			x=a,y=b;
		}
		ans+=sqrt((x-topx)*(x-topx)+(y-topy)*(y-topy));
		printf("%.2lf\n",ans);
	}
	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