Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- double x[101],y[101];
- double len1(int i, int j){
- return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
- }
- int main(){
- int n;
- double r,len;
- scanf("%d %lf",&n,&r);
- for(int i=0;i<n;i++)
- scanf("%lf %lf",&x[i],&y[i]);
- len=2*acos(-1.0)*r+len1(0,n-1);
- for(int i=1;i<n;i++)
- len=len+len1(i-1,i);
- printf("%.2lf\n",len);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement