- 绕钉子的长绳子
- 2014-11-06 08:06:34 @
#include<cstdio>
#include<cmath>
#include<cstdlib>
#define pi 3.141592653
int main()
{
double Circum,R,x0,y0,x1,y1,x,y;
int n,i;
scanf("%d %lf",&n,&R);
scanf("%lf %lf",&x0,&y0);
x1 = x0;
y1 = y0;
for (i=1; i<n; i++)
{
scanf("%lf %lf",&x,&y);
Circum+=hypot(x-x1,y-y1);
x1 = x;
y1 = y;
}
Circum+=hypot(x-x0,y-y0);
Circum+=pi*2*R;
printf("%.2lf",Circum);
//system("pause");
return 0;
}
0 条评论
目前还没有评论...