| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么总是wa#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator