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

Posted by huxinjie800 at 2009-10-14 23:19:10 on Problem 2365 and last updated at 2009-10-14 23:19:27
#include <iostream>
#include <math.h>
#define pi acos(double(-1))
using namespace std;
struct node 
{
	double x,y;
};
int main ()
{
	int n,r,i;
	node head,temp1,temp2;
	double sum;
	while(scanf("%d%d",&n,&r)!=EOF)
	{
		sum=0;
		scanf("%lf%lf",&head.x,&head.y);
		temp1.x=head.x;temp1.y=head.y;
		for(i=1;i<n;i++)
		{
			scanf("%lf%lf",&temp2.x,&temp2.y);
			sum+=sqrt((temp1.x-temp2.x)*(temp1.x-temp2.x)+(temp1.y-temp2.y)*(temp1.y-temp2.y));
			temp1.x=temp2.x;temp1.y=temp2.y;
		}
		temp2.x=head.x;temp2.y=head.y;
		sum+=sqrt((temp1.x-temp2.x)*(temp1.x-temp2.x)+(temp1.y-temp2.y)*(temp1.y-temp2.y));
		sum+=2*pi*r;
		printf("%.2lf\n",sum);
	}
}

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