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 chenjinying at 2009-01-20 14:41:15 on Problem 2365
#include "stdio.h"
#include "math.h"

int main()
{
	float N,R,a1,b1,a2,b2,l=0,i,m,n;

	scanf("%f %f",&N,&R);
	if(N==1)
	{
		scanf("%f %f",&m,&n);
		l=2*3.14*R;
		printf("%.2f\n",l);//是 0.00 还是 2 * 3.14 * R
	}
	else
	{
		scanf("%f %f",&a1,&b1);
		m=a1;
		n=b1;
		for(i=1;i<N;i++)
		{
			scanf("%f %f",&a2,&b2);
			l+=sqrt( (a1-a2)*(a1-a2) + (b1-b2)*(b1-b2) );
			b1=b2;
			a1=a2;
		}
		l+=sqrt( (m-a2)*(m-a2) + (n-b2)*(n-b2) );
		l=l+2*3.14*R;//-----加上园的周长
		printf("%.2f\n",l);
	}

	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