@[wch666](/user/778382) 这题的钉子有半径,所以绕过钉子的这部分周长不能忽略
想一想,怎么计算多出来的这一部分周长?
by Shen_Linwood @ 2024-01-02 21:57:57
AC(经供参考):
```c
#include<math.h>
#include<stdio.h>
double x[102],y[102];
int main()
{
int n;
double r,len=0;
scanf("%d%lf",&n,&r);
for(int i=1;i<=n;++i) scanf("%lf%lf",&x[i],&y[i]);
x[n+1]=x[1];
y[n+1]=y[1];
for(int i=1;i<=n;++i) len+=sqrt(pow(x[i]-x[i+1],2)+pow(y[i]-y[i+1],2));
len+=2*acos(-1)*r;
printf("%.2lf",len);
return 0;
}
```
by timmyliao @ 2024-01-02 22:00:37