Nothing to say.
Here is my code:
#include<stdio.h>
#include<math.h>
#define maxn 107
#define pi acos(-0.1)
int main()
{
/*
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
//*/
long n;
double r,ans,x[maxn],y[maxn];
scanf("%ld%lf",&n,&r);
ans=2*acos(-1.0)*r;
for(long i=1;i<=n;i++)
scanf("%lf%lf",&x[i],&y[i]);
for(long i=2;i<=n;i++)
ans+=sqrt((x[i]-x[i-1])*(x[i]-x[i-1])+(y[i]-y[i-1])*(y[i]-y[i-1]));
ans+=sqrt((x[n]-x[1])*(x[n]-x[1])+(y[n]-y[1])*(y[n]-y[1]));
printf("%.2lf\n",ans);
return 0;
}
posted on 2010-09-21 13:22
lee1r 阅读(143)
评论(0) 编辑 收藏 引用 所属分类:
题目分类:基础/模拟